Tuesday, 26 November 2013

CSS id selector

id Selector


The id selector is used to specify a style for a single, unique element.

The id selector uses the id attribute of the HTML element, and is defined with a "#".

You can choose what You want name for Your id element.

The code below will show You how to specify single elements with id, and how to style them with CSS. 

You have to place Your styles between » » »
<style>
.
.
.
</style>

» EXAMPLE:


<html>
<body>
<style>
#container {
width: 200px;
height: 100px;
background: red;
}

#par {
font-size: 40px;
color: green;
}

#heading {
color: yellow;
text-shadow: 3px 3px 10px orange;
}
</style>

<section id="container">
</section>
<p id="par">This is paragraph.</p>
<h1 id="heading">This is heading</h1>

</body>
</html>


» Result:







This is paragraph.

This is heading