How can I tell if a particular CSS property is inherited with jQuery?

后端 未结 7 654
自闭症患者
自闭症患者 2020-11-29 03:49

This is a very simple question, so I\'ll keep it really brief:

How can I tell if a particular DOM element\'s CSS property is inherited?

Reas

相关标签:
7条回答
  • 2020-11-29 04:50

    http://jsfiddle.net/k7Dw6/

    var $black = $('div.black:eq(0)');
    alert($('<div>').attr('class', $black.attr('class')).css('line-height') === $black.css('line-height'));
    

    You could create a new element with the same class (and ID I guess) and check if the CSS property is the same or not.

    0 讨论(0)
提交回复
热议问题