Computer Science, asked by amitkanha1974, 6 months ago

5 EXPLAIN SELECTOR AND PROPERTY
IN CSS WITH EXAMPLE​

Answers

Answered by duvarakesh222K
1

Answer:

CSS Selector

CSS selectors are used to select the content you want to style. Selectors are the part of CSS rule set. CSS selectors select HTML elements according to its id, class, type, attribute etc.

There are several different types of selectors in CSS.

CSS Element Selector

CSS Id Selector

CSS Class Selector

CSS Universal Selector

CSS Group Selector

1) CSS Element Selector

The element selector selects the HTML element by name.

CSS Id Selector

The id selector selects the id attribute of an HTML element to select a specific element. An id is always unique within the page so it is chosen to select a single, unique element.

It is written with the hash character (#), followed by the id of the element.

<!DOCTYPE html>

<html>

<head>

<style>

p{

text-align: center;

color: blue;

}

</style>

</head>

<body>

<p>This style will be applied on every paragraph.</p>

<p id="para1">Me too!</p>

<p>And me!</p>

</body>

</html>

Test it Now

Output:

This style will be applied on every paragraph.

Me too!

And me!

Similar questions