YouTip LogoYouTip

Sel Element Comma

CSS element,element Selector

CSS element,element Selector

The element,element selector selects elements with the same tag name and applies styles to all of them.

Example

Selects all <p> and <span> elements and sets their font color to blue:

p, span {
  color: blue;
}

Browser Support

All major browsers support the element,element selector.

More Examples

Select all <h1>, <h2>, and <h3> elements and set their font size to 16px:

h1, h2, h3 {
  font-size: 16px;
}

Select all <div> and <section> elements and set their background color to light gray:

div, section {
  background-color: #f0f0f0;
}

Select all <input> and <button> elements and set their border to 1px solid black:

input, button {
  border: 1px solid black;
}

Related Pages

© 2024 - Learn not just technology, but also dreams!

← Sel Element ElementSel Element β†’