element,element

In this chapter you will learn:

  1. Definition for CSS group Selector
  2. An example showing how to use element,element CSS selector

Description

To style several elements with the same style, we can separate each element name with a comma. In this way we group the selectors together and style them the same time. element,element is called group selector.

Example

<!DOCTYPE html><!--  j  a v  a2 s  .  c  o  m-->
<html>
<head>
<style>
h1,p
{
   background-color:red;
}
</style>
</head>
<body>
    <h1>h1</h1>
    <p>paragraph.</p>

</body>
</html>

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. Definition for nested element Selector
  2. An example showing how to use element element CSS selector
Home » HTML CSS Tutorial » CSS Selector Reference
.class
#id
*
element
element,element
element element
element>element
element+element
element1~element2
:lang
:link
:visited
:active
:hover
:focus
:first-letter
:first-line
:first-child
:last-child
:only-child
:nth-child(n)
:nth-last-child(n)
:before
:after
:first-of-type
:last-of-type
:only-of-type
:nth-of-type(n)
:nth-last-of-type(n)
:root
:empty
:target
:enabled
:disabled
:checked
:not
::selection
[attribute]
[attribute=value]
[attribute~=value]
[attribute|=value]
[attribute^=value]
[attribute$=value]
[attribute*=value]