Home of web learners

www.webn3rd.com

selector is use to select which tag you want to design

For example,when you change a paragraph text with p tag and make some design with css,it applied to all text in your webpage having p tag,but you want to change some specific text or some group text.

You can do it by selector

If you want to change only single text in your webpage,you can you id selector

<html>
<head>
<style>
#fun{ color:blue; }
</style>
</head>
<body>
<p id="fun">this is a text</p>
<p>this is another text</p>
</body>
</html>

output:

this is a text

this is another text

Here,you see only having id named fun is changed,another paragraph text color is not changed

So if you want to change specific tag design,take a id and give some name on it.

For using this id of tag,you have to start with #,like here #fun and make some css code on it

Now you need another thing,like you need some grouping where you need same design,like in webpage menu all the link having same design.

So,how to do it?

You can do it by class,class means having the same thing in a group

<html>
<head>
<style>
.funcls{ color:blue; }
</style>
</head>
<body>
<p class="funcls">this is a text</p>
<p class="funcls">this is another text</p>
</body>
</html>

output:

this is a text

this is another text

you see that two text color is changed,here we take a class named funcls and define this class to those element we need change and all element changed same design.

To use class of tag,you have to start with a . and then name of the class,now you make css code to design them.

webn3rd.com

About webn3rd