2012-01-10 142 views
0

我無法使<h2 class="feature_description_content">與圖像保持垂直對齊。你可以看到它比圖像的頂部低很多,我似乎無法找到對它負責的css。如何將H1與DIV頂部對齊

這裏有一個形象:

enter image description here

下面是代碼:

<div class="feature feature-item-248"> 
       <img class="main" src="http://www.bolistylus.com/wp-content/uploads/uclaproduct.png" alt="" /></p> 
<div class="feature_description"> 
<div class="feature_description_header"> 
<h2 class="descript-heading">PERFECTLY WEIGHTED</h2> 

</div> 
<div class="feature_description_content"> 
<p>Touch screens have simplified technology, but there has yet to be a way to capture the precision of a calligrapher or the stroke of an artist. Not only should it meet your needs, but a stylus should have style.</p> 
</div></div> 
</p></div> 

感謝

回答

1

設置其margin-top: 0; - 簡單:)

3

這個問題是必須由於默認邊距和默認HTML elem的填充經濟需求必須嘗試通過設置

h2 { margin:0px; padding:0px; }

,然後根據需要

0

假設是向左浮動和清除這兩種方法的圖像改變填充,使文本能夠正確對齊...

img .main { 
float: left; 
clear: both; 
}