You May wish to define either an ID Selector, a Class Selector or an HTML Selector they all work slightly discreetly and diffrently from each other....
To See about Creating an ID Selector read this page, and also the Twisted Panties page: To see about Class Selectors see the Navy Blue Cotton Panties page.
An ID Selector is usually defined like so:
#nameoftheid { position:relative; }
where the nameoftheid is a name choosen by you, and the property could be say a position or margin-left or margin-right or a whole load of other properties. The part above called relative is in fact a value always, and thus you could have a line like this:
position:absolute;
Again notice in the structure of the ID Tag, it will be like it is described below:
#navbox
{
position:absolute;
margin-left:2%;
margin-top:0px;
width: 10%;
height:50PX;
float:left;
background:#0000CC;
}
All the statements in between the Curly Brackets must end in a Semi Colon. An ID Selector alwaysstarts with a # symbol and the ID name with no spaces in it!
There can be various statements inside the curly brackets: but each one will be a property then a colon then a value. We will not try to teach them to you here, you will learn then as you build more ID Selectors your self.
So here is some important information to help you learn the diffrences between using ID Tags, and defining Classes.
The diffrence between IDs and Classes will become apparent after you have learnt more about using css positioning. IDs are used to give each element on the screen a diffrent unique name and identity. This is why an ID Selector is only used Once for One element in a Document. This also makes it into an object that can be manipulated by Java Script.
A Class Selector can be set up to give you an independant Style that can be applied to any tag, that is any HTML Tag. A Class Selector is oftern placed inside the head tag of the web page in question, in other words, not necessarily in a separate Style Sheet.
Say you have a Class declaration like this:
.bright_red (
color:#800080;
}
To actually apply this style to a p tag you could have,
<p class="bright_red">This will be bright red</p>
thus here the text in this particular p tag that is of class bright_red will be the characteristics of that class selector!
Please Note that This Class Declaration can be either made inside the head tag of the actual Web page you want to use it in, or it can be placed inside a style sheet that is linked to the Web page, or imported in to a Web page. This could easily get your knickers in a twist since I have mentioned three alternatives which are:
1. a class selector declared in the head of a web page
2. a class selector declared in a style sheet that is linked to a web page and
3. a class slecter declared in a style sheet that is imported into a Web Page.