Read "JavaScript DOM Programming Art (2nd edition)" Note 9

Source: Internet
Author: User

The Style property is an object and can only return inline styles.

When you need to reference a CSS property with a minus sign in the middle, the DOM asks for the hump naming method, that is, the CSS property font-family becomes the DOM attribute fontFamliy:element.style.fontFamily

Regardless of the number of hyphens in the CSS style attribute's name, the DOM is all represented by the Hump naming method, which is the CSS property backg-color corresponding to the DOM attribute backgroundcolor.

CSS3 Brother selector: e~f

Syntax: e~f{....}

Selects all sibling elements after the E element f

CSS3 adjacent selector: e+f

Syntax: e+f{....}

Choose to cling to the E element after the F element

Pseudo-class: hover used to change the style of the link, if you want to use the pseudo-class when the mouse pointer over other elements to change the style, the browser is not so much to support this usage.

The ClassName property, which is a readable/writable property, has this attribute for all element nodes. You can use the ClassName property to get the class attribute of an element: element. ClassName can also update element properties: Element.classname=value, the disadvantage: Setting the Class property of an element with the ClassName property replaces the original class setting of the element.

Append the new class setting value to the ClassName attribute: elem.classname+= "Inrto";

Read "JavaScript DOM Programming Art (2nd edition)" Note 9

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.