It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming CSS Forum Script-archive

CSS Basics - Defining Classes and IDs

Share your completed scripts.

CSS Basics - Defining Classes and IDs

Postby HotNoob on Wed Sep 22, 2010 2:59 am

Well most of you probably know how to define tags... Right?
Code: Select all
a
{
color: black;
}

Right?

Well defining a tag specific for a class is essentially quite the same and much more useful
To create one, instead of typing in a, or linkClass, you use the name .linkClass
Code: Select all
.linkClass
{
color: yellow;
}

This would make any text that you add this tag to, yellow. for example
Code: Select all
<a href="http://CCGames.tk" class=linkClass>CCGames.tk</a>

Would output a yellow link:
CCGames.tk

Code: Select all
<span class=linkClass>YELLOW TEXT</span>


Now, you can also do the same thing, except with ids! Rather than ".," you replace it with "#"
For example
Code: Select all
#linkId
{
color: yellow;
}


Would produce yellow text with the following code
Code: Select all
<span id=linkId>YELLOW TEXT</span>


Now lets say that you want to get advanced! Let's say you only want an id to turn a certain color if it is in a specific id.

Code: Select all

#red
{
color: red;
}
#red blue
{
color: blue;
}


Here is an example of the results
Code: Select all
<span id=blue>Not-Blue,</span><span id=red>RedText,<span id=blue>BlueText</span></span>

This would output something like this:
Not-Blue,RedText,BlueText

Hope i helped, and feel free to ask questions on this forum!
HotNoob
100+ Club
 
Posts: 169
Joined: Sun May 02, 2010 1:38 am

Who is online

Users browsing this forum: No registered users and 1 guest