CSS element,element Selector

Complete CSS Reference Complete CSS Reference

Example

How to style all <div> elements AND all <p> elements:

div,p
{
background-color:yellow;
}

Try it yourself »

Definition and Usage

Separate selectors, using commas, to style more than one element with the same style.

The element,element selector styles all elements with either one of the specified tagnames.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The element,element selector is supported in all major browsers.


CSS Version

The element,element selector was first introduced in:

CSS 1


Examples

Try it Yourself - Examples


Example

How to style many elements with the same style:

p,h1,h2
{
background-color:yellow;
}

Try it yourself »

Complete CSS Reference Complete CSS Reference