The CSS type selector matches element by node name (e.g. div, h1. h2). This can be used to specify CSS style based on element type.
Here is the syntax for defining style using type selector.
element { style properties }
Example – div style using type selector
<style> div { width: 100px; height:100px; background-color: lightgreen; } </style> <div> Hello world </div>
Related
- CSS universal selector
- CSS attribute presence and value selectors
- CSS attribute substring selectors
- CSS class selectors - define style by class name
- CSS - style for element having two classes (both)
- CSS id selectors - define style by element id