element,element - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:element group

Description

To select several elements, separate each element name with a comma.

Example

Select all <h1> elements AND all <p> elements:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
h1, p {<!--from   ww w.j  a v a  2 s .com-->
    background-color: red;
}
</style>
</head>
<body>

<h1>Welcome to My Homepage</h1>

<div>
  <p>this is a test.</p>
  <p>this is a paragraph.</p>
</div>

<p>I <b>like</b> css.</p>

</body>
</html>

Related Tutorials