开发者

text-align always return left by jQuery in IE

Not sure why text-align property always return left in jQuery for IE?

<script>
    $(function() {
       alert($('#ctl00').css('text-align'))
    });
</script>

<span style="开发者_StackOverflow社区font-weight: bold; text-align: center;" id="ctl00">


this fixed the problem:

textAlignProp = $(this).css('textAlign');

using textAlign instead of text-align.


text-align won't work reliably inside a span, because it's not a block-level element. Test it out inside a div, and I think you'll find the results more predictable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜