0% completed
CSS selectors let you choose which HTML elements to style. In this lesson, we focus on element selectors. These selectors help you apply styles directly to tags such as <h1>
, <p>
, or <div>
. Element selectors are easy to use and make your code clear. They target all instances of a specific HTML element in your document.
Follow below syntax to add an element selector in CSS.
element { property: value; }
Explanation:
p
, h1
).In this example, we will style all <p>
tags in an HTML document. The example shows how to change the text color and font size for paragraphs.
Explanation:
<p>
Elements:
p
selects all paragraph elements in the document.In this example, we will style all <h1>
tags in an HTML document. The example demonstrates how to change the heading color and add a bottom margin for better spacing.
Explanation:
<h1>
Elements:
h1
selects all heading level one elements in the document.<h1>
for improved layout.<h1>
tags in the document are styled consistently.This lesson on element selectors shows two ways to apply styles to specific elements. The examples help you understand how to target different HTML elements with ease and clarity.
.....
.....
.....