CSS type selectors – define style by element name

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

div {
  width: 100px; height:100px;
  background-color: lightgreen;

  Hello world



Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments