Selecting Elements by Type

Description

You can select all of the instances of an element using the element type as the selector.

  • Selector: elementType
  • Matches: All elements of the specified type
  • Since CSS Version: 1

Example

The following code uses the Element Type Selector.


<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<style type="text/css">
a {<!--   w  w  w.  j  ava2  s.  c o m-->
  border: thin black solid;
  padding: 4px;
}
</style>
</head>
<body>
  <a href="http://java2s.com">Visit the website</a>
  <p>This is a test.</p>
  <a href="http://w3c.org">Visit the W3C website</a>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table