3 replies [Last post]
homchz
Offline
Enthusiast
Last seen: 13 years 37 weeks ago
Joined: 2004-07-23
Posts: 77
Points: 0

I am relativly new to CSS and have been messing aroudn with it for a few weeks. I just picked up a few books, and am now a bit confused.

How many ID tags do you have for a site? What I am reading, and I could be reading it all wrong, says and ID tags are only supposed to be used once. Is that per page?

I have been using ID tags to define an area and syle tags to define text (now seem like to much work, and I will be changing a few things). But the real question is. Are you not supposed to have more than one ID tag per page?

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 37 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Better Understanding

You can have more than one 'ID' tag per page but they are unique and can only be used once per specific name i.e #container can only be used once on the page but can be used on the next page that requires the same div styling; classes on the other hand can be used over and over again on the same page; also remember that IDs hold a higher specificisity (sic) than classes.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

homchz
Offline
Enthusiast
Last seen: 13 years 37 weeks ago
Joined: 2004-07-23
Posts: 77
Points: 0

Better Understanding

So if I am buling a header for a navigation column is could be a class instead of an id?

I was doing it like this:

<div id="navheader">
				<div class="textcenterbold">New Investor Information</div>
			</div>
			<div id="navbox"> 
				<div class="navboxtexth1"><a href="YankeeInfo.php">Company Information</a></div>
				<div class="navboxtexth1"><a href="Invest.php">Investment Seminars</a></div>
				<div class="navboxtexth1"><a href="STPD.php">St. Patrick's Day Trade Show</a></div>
		  </div>
		</div>
			<div id="navheader">
				<div class="textcenterbold">Equipment Navigation</div>
			</div>
			<div id="navbox">
				<div class="navboxtexth1">Laundromat Equipment</div>
				<div class="navboxtexth2"><a href="SpeedQueen.php">Speed Queen</a></div>
				<div class="navboxtexth2"><a href="Huebsch.php">Huebsch</a></div>
				<div class="navboxtexth2"><a href="Milnor.php">Pellerin Milnor</a></div>
				<div class="navboxtexth1">OPL/Commercial Equipment</div>
				<div class="navboxtexth2"><a href="MilnorCom.php">Pellerin Milnor</a></div>
				<div class="navboxtexth2"><a href="Chicago.php">Chicago Dryer Company</a></div>
				<div class="navboxtexth2"><a href="SpeedQueenCom.php">Speed Queen</a></div>
				<div class="navboxtexth2"><a href="HuebschCom.php">Huebsch</a></div>
				<div class="navboxtexth1"><a href="MiscEquip.php">Misc. Equipment</a></div>
			</div>
			<div id="navheader">
				<div class="textcenterbold">Dept. Navigation</div>
			</div>
			<div id="navbox">
				<div class="navboxtexth1"><a href="Sales.php">Sales Department</a></div>
				<div class="navboxtexth1"><a href="Service.php">Service Department</a></div>
				<div class="navboxtexth1"><a href="Parts.php">Parts Department</a></div>
				<div class="navboxtexth1"><a href="Contact.php">Company Directory</a></div>
			</div>

Using "id" as a holder more or less and class as a font characteristic

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 5 years 37 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Better Understanding

You can't use the #navheader and #navbox like you have as they are repeated they would have to be classes although looking at your code I can't help but feel that there are a lot of classes going on and wonder wheather some may actualy be addressed through contextual selectors styling as div.navbox a {property:attribute;}

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me