Selectors types in CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>CSS Selectors</title>
<!--<style>
Element selector
p {
color: red;
}
Id selector
#redElement {
color: green;
}
.secondPara {
color: yellow;
}
Class selector
.bgBlue {
background-color: blue;
}
Grouping selector
footer,
span {
color: white;
background-color: red;
}-->
</style>
<link rel="stylesheet" href="CSS/styleTwo.css">
</head>
<body>
<h3>CSS Selectors</h3>
<!--There can be multiple selectors like Grouping selector, Class selector, Id selector-->
<p>This is a simple paragraph to demostrate css selectors</p>
<!--Id must be Unique and Class can be multiple-->
<p id="redElement">This is a another simple paragraph to demostrate css selectors</p>
<div>
<p class="secondPara bgBlue">This is yet another simple paragraph inside div to demonstrate css selectors</p>
<span>This is span Tag paragraph</span>
</div>
<footer>This is footer</footer>
</body>
</html>

Comments
Post a Comment