课程: CSS Essential Training

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Class selectors

Class selectors

- [Presenter] When type selectors are too general but you'd need more flexibility than IDs. There's another option. The class selector, which matches to one or more elements based on the class attribute value. Similar to IDs, to use a class, it must first be added to the HTML tag and just like IDs, the value is defined by you. But when used as a CSS selector, it starts with a period. The same class name can be reused throughout the page by adding the same value to any number of elements. The selector only matches to the class name, so it doesn't even have to be the same type of element. You can also use multiple classes with the same element. The order doesn't matter but each class name must be separated by a space and contained within the quotation marks. For example, any element with either the fancy or highlight class name will have the corresponding styles applied to it. If the element contains both class names then…

内容