How to use CSS element Selector

Description

The element selector adds style to all elements with the specified element name.

Example


<!DOCTYPE html>
<html>
<head>
<style>
p{<!--from  w w w  . j  av a2s .  c o m-->
    background-color:red;
}
</style>
</head>
<body>
   <p>java2s.com.</p>
</body>
</html>

Click to view the demo

The code above generates the following result.

element




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference