对齐span元素左格
问题描述:
的是否有可能对准跨越“头”在这个小提琴:http://jsfiddle.net/25LjE/37/文字的如右图所示:对齐span元素左格
我使用jQuery创建的标题。
这里是小提琴代码:
<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>
.pds-pd-link {
display: none !important;
}
.pds-box {
width: 220px !important;
}
.pds-input-label{
width: auto! important;
}
.PDS_Poll{
margin-bottom:15px;
}
$(document).ready(function() {
$('.pds-question-inner').prepend('<center><span style="color:red;font-weight:bold;font-size: 10pt"><u>Header</u></span></center>');
});
当我尝试在IE8中提出的解决方案,该文本是略高于文字的休息:
这个问题能解决吗?
答
你只需要在
<span style="color:red;font-weight:bold;font-size: 10pt;float:left"><u>Header</u></span>
float:left
选中此项:
答
这是不是真的我清楚你想什么才达到,但加入这个CSS似乎得到这个工作:
center span{
position:relative;
top:30px;
left:-70px;
}
答
你可以做到这一点通过包装两种情况,即左浮动一个div您的两个元素,那么你可以附加前置头代替。
<div class="floatLeft">Your two elements</div>
<style>
.floatLeft {
float: left;
display: inline-block;
}
</style>
您可能想要设置元素的宽度和填充/边距,以便它们根据需要出来。如果你想把标题的方式向右移动,你可以将它向右而不是向左移动。如果你坚持使用prepend,因为如果右边的浮动元素不是系列中的第一个,那么IE的某些版本会浮起来。
答
我认为这是你想要的?
$('.pds-question-inner').prepend('<center><span style="color:red;font-weight:bold;font-size: 10pt; text-align: right; display: block;"><u>Header</u></span></center>');
如果不是它应该是,看起来更好:P
.prepend( '的部首') ; – 2012-07-05 13:04:13
将标题对齐到右侧还是左侧?在你的照片上显示出来,并在你的问题描述中,你说得对 – Huangism 2012-07-05 13:08:40