Loading

Element Selector

  •  Element selectors are one of the most basic and widely used types of selectors in CSS.
  • They are used to target and apply styles to HTML elements based on their tag names.

Key Points:

  • Element selectors offer a convenient way to apply consistent styling across multiple elements of the same type within a webpage. 
  • They are especially useful for maintaining design coherence and readability across different sections of a site. 
  • By targeting specific HTML tags, developers can efficiently control the appearance of various elements, enhancing the overall visual presentation of web content.

Syntax:

elementname {
   property: value;
   /* Additional properties and values */
}
  • An elementname is the name of the HTML element you want to select (e.g., div, p, h1, a, etc.).
  • property is the CSS property.
  • value is the value we want to assign to the property (color etc..).

Example:

<!DOCTYPE html>
<html>

<head>
	<style>
		p {
			text-align: center;
			color: blueviolet;
		}
	</style>
</head>

<body>
	<p>This property will be applied on every paragraphs.</p>
	<p id="para1">Welcome to!</p>
	<p>Quipoin!</p>
</body>

</html>  

Output:

This property will be applied to all paragraphs.

Welcome to

Quipoin