CSS selectors?

He has: 37 posts

Joined: May 2008

Hi,

I'm new to CSS and just wondering why some selectors start with a dot and some with a hash and some with nothing?

EG:

.center table
text-align: left;
}

#contentBottom {
background:white url('images/backbottom.gif') no-repeat;
}

a{text-decoration: underline;color: blue;}

Thanx

He has: 629 posts

Joined: May 2007

table = the table element <table> ... </table>

#contentBottom = the single element with this ID <div id="contentBottom"> ... </div>

.center = any and all elements with this class <div class="center"> ... </p>

HTH

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

He has: 37 posts

Joined: May 2008

Got it, thanx Wink

Tedseo's picture

They have: 10 posts

Joined: Apr 2011

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 "#".

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.