2012-01-10 109 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; 
}