Saturday, March 12, 2016

CSS Selector

Sampili Tuition     12:54 AM     No comments

Style can be applied to specific html elements by specifying the html elements, then enclosing the styles within curly brackets .The following example shows a style being applied to the html element <p>.
p{color:blue;}
In this example all html <p> elements in the document would have a text color of blue.
There are many different types of selectors that allow great flexibility in applying style to elements.
 Class and ID Selector:
In addition using the html element selectors custom selector can also be defined,in the form of Class and ID selectors.This allow having the same html elements , but styled differently depending on its cl;ass and Id .An Id selector can be used to identify one element,whereas a class selector can be used to identify more than one elements.
In CSS a Class selector is a name prrceded by a period (.) and ID selector is a name preceded by a pound sign (#).
The following example shows a  class selector and an Id selector.
.highlight{
color:blue;
font-weight:bold;
}
#codebox{
background-color:#000000;
padding:15px;
border-style:solid;
border-width:1px;
}
This following example uses these style in html code...
<div id="codebox">
<p>
"normal" text here
</p>
<p class="highlight">
"highlight" text here.
</p>
</div>

CSS Comments:
In CSS a comments start with /* and end with */ sign.
Comments can span multiple lines but may not be nested.
Example:
/* This is one line comment */
/* This is multiple
lines comments */

0 comments :

Today is


Tutorials

Recommended

Find Us On Facebook

Company

Blender

Legal Stuff

FAQ's

Blogroll

Javascript

Subscribe to Newsletter

We'll never share your Email address.
© 2015 Sampili. Blogger Templates Designed by Bloggertheme9. Powered by Blogger.