在特定高度的定位元素

问题描述:

在下面的小提琴中,文本“标题”(红色)显示比问题文本的其余部分略高。文本的高度如何降低?在特定高度的定位元素

我试过使用“top -30px”?

http://jsfiddle.net/25LjE/44/

.pds-pd-link { 
display: none !important; 
} 
.pds-box { 
    width: 220px !important; 
} 
.pds-input-label{ 
    width: auto! important; 
} 
.PDS_Poll{ 
    margin-bottom:15px; 
} 

<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/6352993.js"></script> 
<noscript><a href="http://polldaddy.com/poll/6352993/">This is very long test question to test how polldaddy handles questions that exceed that normal length............ yes a very long question indeed..............</a></noscript> 

$(document).ready(function() { 

    $('.pds-question-inner').prepend('<center><span style="color:red;font-weight:bold;font-size: 10pt;float:left"><u>Header</u></span></center>'); 
}); 
+0

混合内联和块标记是一个坏主意。你为什么不在'div.pds-question-top'内部而不是在'div.pds-question-top'中添加'center'标签? – 2012-07-09 14:51:26

+2

'

','',还是90年代? – elclanrs 2012-07-09 14:51:59

首先,不浮动头span跨度。保持内联。所以从你的js中删除这个声明。

其次,问题在于.pds-question-top元素上的填充顶部正在将段落文本向下推。尝试将其设置为零,一切都很正常。无论如何,这是更清洁的。我通常更喜欢使用p元素的底部填充创建所有段落间距,并且不使用顶部填充,以便段落始终始于我想要的位置。

参见:

http://jsfiddle.net/25LjE/56/

尝试line-height:或vertical-align