2013-02-23 22 views
2

我需要獲取文本和圖像在同一行中居中。即時通訊在jQuery中使用data-role =「header」函數,但似乎無法將所有內容都集中在一行中。該CSS是Jquery的標準我需要一些幫助中心和獲取文本和圖像內聯(jquery)

<html> 
     <head> 
      <meta charset="utf-8"> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <title>jQuery</title> 
       <link rel="stylesheet" href="themes/scavenger-hunt.min.css" /> 
      <link rel="stylesheet" href="Publish/jquery-mobile/jquery.mobile.structure-1.0.min.css" /> 
      <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script> 
      <script src="http://code.jquery.com/mobile/1.3.0-rc.1/jquery.mobile-1.3.0-rc.1.min.js"></script> 
     <body> 

<div data-role="page" id="home"> 
    <div data-role="header"> 
    <h1>Scavenger</h1><img src="images/logosh.png" alt="logo" width="50" height="50" align="absmiddle"><h1>Hunt</h1> 
</div> 
+0

所以,你想有清道夫亨特? – BenM 2013-02-23 21:15:12

回答

0

把你的H1的第一那麼你的圖像最後在HTML和CSS應該是這樣的

#home > div h1:first-child {float:left} 
#home > div h1 {float:right} 
img {display:block; margin-left:auto; margin-right:auto;} 

這裏有一個小提琴http://jsfiddle.net/tbd5f/1/

+0

我想* OP想要圖像和文本在一行中(即'display:inline',但在標題中居中。 – BenM 2013-02-23 21:18:38

0

我強烈反對從將標題拆分爲兩個單獨的<h1>元素,因爲這是不必要的也不太正確:P

嘗試使用t他的HTML代碼:

<h1> 
    Scavenger 
    <img src="http://placehold.it/50x50" alt="logo" width="50" height="50" align="absmiddle"> 
    Hunt 
</h1> 

而這個CSS:

h1 { 
    text-align: center; 
}