Element selectors are basic selectors that choose elements from HTML. Most often, these elements are the basic tags of HTML. The following table lists some of the selectors and their usage for this category:
CSS query |
Description |
h1 |
Selects <h1> elements |
a |
Selects all of the <a> elements |
* |
Selects all elements in the HTML code |
body * |
Selects all <h1>, <p>, <div>, and <a> elements inside <body> |
div a |
Selects all <a> inside <div> (using space character in between) |
h1 + p |
Selects immediate <p> elements after <h1> |
h1 ~ p |
Selects every <p> elements preceded by <h1> |
h1,p |
Selects all <h1> and <p> elements |
div > a |
Selects all <a> elements that are a direct child of <div> |