2015-10-13 79 views
1

我在做什麼錯? :|將文字放在圖像css旁邊,似乎不起作用

<div id=Content> 
        <h1>Welcome to the Sophia Centre press</h1> 
        <h2>New Publications Avaible Soon</h2> 

        <div id=Malta> 
        <img src ="images/Malta.jpg" alt="Malta" class="book"> 
        <p>Tore Lomsdalen</p> 
        <p><em>Sky and Purpose in Prehistoric Malta: Sun, Moon, and Stars at the Temples of Mnajdra.</p></em> 
        </div> 

        <div id=Greene> 
        <img src="images/Greene.png" alt="Greene" class="book"> 
        <p>Liz Greene</p> 
        <p><em>Magi and Maggidim: The Kabbalah in British Occultism 1860-1940.</em></p> 
        </div> 
        </div> 

和CSS

h1{ 
 
    
 
     padding: 1em; 
 
} 
 
h2{ 
 
     padding-left: 1cm; 
 
     color: #FF9900; 
 
} 
 
    
 

 
p { 
 
     clear: both; 
 
     margin: 0% 0% 0% 20%; 
 
} 
 
    
 
    
 
.book{ 
 
float: left; 
 
padding: 2em; 
 
}

它的外觀1) 那應該怎麼找2)

http://imgur.com/a/DqjnQ

我只是想在文本內容 HALP

+1

請你的代碼添加到你的問題,沒有鏈接。如果你沒有「隱藏」他們的關鍵部分,你會有更好的機會回答你的問題。 – hungerstar

+0

@hungerstar好吧,感謝您的建議 – thedumbone

回答

0

旁邊的圖像移動你所尋找的是財產display: inline-block

<img>標籤是自然的內聯,而無需將其設置,但因爲你正在試圖內聯的<p>標籤,你需要它們的容器設置爲display:inline-block考慮到它。

代碼更改:

 <div id=Malta> 
      <img src ="images/Malta.jpg" alt="Malta" class="book"> 
      <div class="textContainer"> 
       <p>Tore Lomsdalen</p> 
       <p><em>Sky and Purpose in Prehistoric Malta: Sun, Moon, and Stars at the Temples of Mnajdra.</p></em> 
      </div> 
     </div> 

CSS:

.textContainer { 
    display: inline-block; 
} 
+0

它現在似乎工作,雖然我仍然有圖像底部旁邊的文本,如果我現在改變任何東西,它會破壞整個內容:F – thedumbone

+0

不知道你是什麼意思:/工作我的本地頁面基於我對問題的解釋 –

+0

http://i.imgur.com/oXaUd7H.png – thedumbone