JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

16.1.4 Nonstandard Properties

Similarly, the border, margin, and padding properties are shortcuts for properties that specify borders, margins, and padding (space between the border and element content) for each of the individual sides of an element. For example, instead of using the border property, you can use border-left, border-right, border-top, and border-bot tom properties to specify the border of each side separately. In fact, each of these properties is itself a shortcut. Instead of specifying border-top, you can specify border-topcolor, border-top-style, and border-top-width.

16.1.4 Nonstandard Properties

When browser vendors implement nonstandard CSS properties, they prefix the property names with a vendor-specific string. Firefox uses moz-, Chrome uses -webkit-, and IE uses -ms-. Browser vendors do this even when implementing properties that are intended for future standardization. One example is the border-radiusproperty, which specifies rounded corners for elements. This was implemented experimentally in Fire-fox 3 and Safari 4 using prefixes. Once the standard had matured sufficiently, Firefox 4 and Safari 5 removed the prefix and supported border-radius directly. (Chrome and Opera have supported it for a long time with no prefix. IE9 also supports it without a prefix, but IE8 did not support it, even with a prefix.)

When working with CSS properties that have different names in different browsers, you may find it helpful to define a class for that property:

.radius10 {

border-radius: 10px; /* for current browsers */

-moz-border-radius: 10px; /* for Firefox 3.x */

-webkit-border-radius: 10px; /* For Safari 3.2 and 4 */


With a class like this defined, you can add “radius10” to the class attribute of any element to give it a border radius of 10 pixels.

友情链接It题库(| 版权归yishouce.com所有| 友链等可联系|粤ICP备16001685号-1