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

<style>
div {
  width: 100px; height:100px;
  background-color: lightgreen;
}
</style>

<div>
  Hello world
</div>
refresh

Related

Specification

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

Comments

Click here to write/view comments