Reply LinkBack Thread Tools Search this Thread
Old 06-09-2005, 12:29   #1 (permalink)
davefromscratch
Registered User
 
Join Date: Aug 2005
Posts: 38
Please Explain CSS Style Differences

This is basic stuff and im quite new to this but can someone explain the difference between styles using # and . and ones without. I can't find any basic sites explaining it and its just totally confusing me at the mo!!?

And how from a linked external css file can you get all the page margins to zero or do you have to do that in the actual page?

Im also looking to have a constant footer at the base of my page say 40px tall but when i put it in it lines up completely differently to the rest of the page?

Thanks for any help
Dave
  Reply With Quote
Old 06-09-2005, 12:46   #2 (permalink)
emil
dt immigrant
 
emil's Avatar
 
Join Date: Nov 2004
Location: Bucharest - Romania
Posts: 6,830
Send a message via ICQ to emil Send a message via MSN to emil Send a message via Yahoo to emil Send a message via Skype™ to emil
# = ids - these are unique can only be applied once per page (div id="header")
. = classes - these can be applied to several items on the same page, and can be combined (<p class="whiteText">, <a class="whiteText">, <p class="witheText bold">)
there is no sign before HTML tags (body, div, a, etc)

to have zero margins use in your CSS
body {margin:0px; padding:0px;}
  Reply With Quote
Old 06-09-2005, 13:21   #3 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
Quote:
Originally Posted by emilpaun
to have zero margins use in your CSS
body {margin:0px; padding:0px;}
Actually, that would just put zero margin/padding on "body".

To remove all margins and padding from every HTML element on the page, I always start my stylesheets with...

Code:
* { padding: 0; margin: 0; }
  Reply With Quote
Old 06-09-2005, 13:24   #4 (permalink)
emil
dt immigrant
 
emil's Avatar
 
Join Date: Nov 2004
Location: Bucharest - Romania
Posts: 6,830
Send a message via ICQ to emil Send a message via MSN to emil Send a message via Yahoo to emil Send a message via Skype™ to emil
I thought that was what he meant by page margins?
  Reply With Quote
Old 06-09-2005, 14:54   #5 (permalink)
davefromscratch
Registered User
 
Join Date: Aug 2005
Posts: 38
Ok cheers guys, in terms of making say a box which is it better to use a (#) or (.) style

And why has PGO used a (*)

*{
padding: 0;
margin: 0;
}

what does that symbolise is that refering to everything instead of putting body there?
  Reply With Quote
Old 06-09-2005, 15:48   #6 (permalink)
Cborrow
I like code.
 
Join Date: Dec 2004
Location: Chesapeake, VA
Posts: 217
Send a message via AIM to Cborrow
If you are making a box you can do it with eiter Id's or Class's but try an ID, like something like this.

Code:
<div id="box"> <p> </p> </div>

Code:
/*your css*/ #box { padding: 5px; margin: 0px; width: 200px; height: 200px; border: #000000 solid 1px; }

That will make you a 200x200 box with a black border. But I think you sould already know that.
Any way just try something like that.

Oh, and yes the * is for all like you can use that in PHP (SELECT * FROM table).

Hope that helped.
  Reply With Quote
Old 06-09-2005, 18:28   #7 (permalink)
Luke Redpath
Barney army!
 
Luke Redpath's Avatar
 
Join Date: Mar 2003
Location: London
Posts: 696
Quote:
Originally Posted by Cborrow
Oh, and yes the * is for all like you can use that in PHP (SELECT * FROM table)..

Er, thats SQL, not PHP.
__________________
Luke Redpath .::. Software Engineer .::. Reevoo - Real Reviews From Real Customers
  Reply With Quote
Old 06-09-2005, 18:54   #8 (permalink)
davefromscratch
Registered User
 
Join Date: Aug 2005
Posts: 38
Wicked Guys that me sorted with a better understanding! But why can you creates boxes with both # and . and which is best to use? This one #?
  Reply With Quote
Old 06-09-2005, 19:50   #9 (permalink)
Cborrow
I like code.
 
Join Date: Dec 2004
Location: Chesapeake, VA
Posts: 217
Send a message via AIM to Cborrow
Quote:
Originally Posted by Luke Redpath
Er, thats SQL, not PHP.

lol, yeah I was thinking of adding SQL in with PHP with the mysql_query();
  Reply With Quote
Old 07-09-2005, 02:21   #10 (permalink)
emil
dt immigrant
 
emil's Avatar
 
Join Date: Nov 2004
Location: Bucharest - Romania
Posts: 6,830
Send a message via ICQ to emil Send a message via MSN to emil Send a message via Yahoo to emil Send a message via Skype™ to emil
Quote:
Originally Posted by davefromscratch
Wicked Guys that me sorted with a better understanding! But why can you creates boxes with both # and . and which is best to use? This one #?
http://www.tizag.com/cssT/cssid.php
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8