CSS class and ID selector

CSS class selector
When we want that HTML tags are changed in each of the web pages to be – for the use of the pair is selectors . But in a different form than what we would like to see some common tag? For example, some heading and paragraph will be red, so maybe they are visible especially where the other headings and gray paragraph. Class selector is used in such cases. Let’s see an example of a class selector graphically.

In the form of a variety of groups are characterized by a style to apply to the class. class selector or selectors with multiple tags can be used with one. Before the class name of a dot (.) symbol sitting. .myClass Can be used as a CSS class declare. Note that dot (.) After the number can not be used.

Note: Properties to build components such as custom html tag:

and element can be used in the class.

Example :

<!DOCTYPE HTML>

<html>

<head>

<style>

.myClass{font-family: Verdana;

box-shadow:5px 5px 5px #ccc;

border:5px solid #eee;}

</style>

</head>

<body>

<p class=”myClass”>CSS3 along with HTML5 is at the cutting

edge of the Webdesign and Webdevelopment.</p>

</body>

</html>

Output :

 

 

CSS3 along with HTML5 is at the cutting
edge of the Webdesign and Webdevelopment.

 

 

 

 

CSS ID selector:
Like the Class ID selector with the same ID attribute applies upadanasamuhe style. Id attribute is used to connect to a particular individual identifier. It can point to a single element can be used only once per page. Selectors to create id name to be added to the # mark. Example:

Note that elements of the class and the id attribute must have both. But the same name should not be used for both. Notice given under the graphical presentation –

Example:

<!DOCTYPE HTML>
<html>
<head>
<style>
#uniqueId{font-family: Verdana;
box-shadow:5px 5px 5px #ccc;
border:5px solid #eee;}
</style>
</head>
<body>
<p id=”uniqueId”>CSS3 along with HTML5 is at the cutting
edge of the Webdesign and Webdevelopment.</p>
</body>
</html>

Output:

 

CSS3 along with HTML5 is at the cutting
edge of the Webdesign and Webdevelopment.

 

2 thoughts on “CSS class and ID selector

  1. Can I simply just say what a relief to uncover somebody who actually understands what they are
    talking about over the internet. You actually
    realize how to bring an issue to light and make it important.
    More and more people really need to check this out and understand this side of the story.
    I was surprised you are not more popular since you
    surely have the gift.

  2. Amazing! This blog looks exactly like my old one! It’s
    on a entirely different subject but it has pretty much the same page
    layout and design. Outstanding choice of colors!

Leave a Reply

Your email address will not be published. Required fields are marked *