Use CSS Selectors To Style Elements

What is CSS Selectors:
                
CSS Selector is the combination of an element selector and a selector value which identifies the web element within a web page. The composite of an element selector and selector value is known as Selector Pattern. Selector Pattern is constructed using HTML tags, attributes and their values. CSS selectors are used to select the HTML element which you want to style. In previous section you were styling that's h1 and p element with inline css, but there is a better way to apply css.To Use CSS Selectors To Style Elements follow the below steps:
Step1: Open your text editor or Notepad.
Step2: Write the below code in your editor or notepad.
Step3: Save your document in etc.html format.
Step4: Open in Browser. 

For Example:

<html>
<head>
<title> your web page title name </title>
<style>
h1{
color: red;
}
p{
color: blue;
}
</style>
</head>
<body>
<h1> your first heading </h1>
<p> your paragraph </p>
</body>
</html>


Output:
















Contribute By Shreya Vardhan

Please Share To Other:

Post a Comment

0 Comments