JQuery.css () behaves differently in FF and IE

When there is no border, why does IE return medium, and FF returns 0pxin the next request?

.css("border-left-width")

I tested this in FF 3.6.3 and IE 6/7.

Example here

+3
source share
3 answers

Using css()reading styles applied in styles does different things in different browsers.

IE IE- currentStyle, . currentStyle , CSS , , . , border-width "", .

css() CSS DOM 2 getComputedStyle(). IE currentStyle, " ", , , ", .

3px, , -, , border-style: none. border-width .

" " " , , , jQuery css(). .

+7

, . , . , , IE , FF , 0.

+1

Whenever you design a web style, you should always reset all elements to defaults so that they are compatible in all browsers.

Include the YUI reset package in your css so that all values ​​are displayed in all browsers.

http://developer.yahoo.com/yui/reset/

Then, when you call the value of the css element, everything will start from the same value, unless another jquery instance has changed it before you ask for the value.

0
source

Source: https://habr.com/ru/post/1747756/


All Articles