Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS element.class selector

CSS element.class Selector

Complete CSS SelectorComplete CSS Selector Reference Manual

Example

Selects all

elements, and set the background color to yellow:

p

.hometown

{

background-color:

yellow

;

}

Try it »


Definition and Usage

element.class The selector combines an element selector and a class selector to select specific HTML elements with a given class attribute.

Reference .class Selector.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support element.class selector.


Complete CSS SelectorComplete CSS Selector Reference Manual