开发者

text-align always return left by jQuery in IE

开发者 https://www.devze.com 2023-01-05 04:08 出处:网络
Not sure why text-align property always return left in jQuery for IE? <script> $(function() { alert($(\'#ctl00\').css(\'text-align\'))

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

精彩评论

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