2015-10-13 45 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