CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 22nd, 2004, 01:03 PM
mhulse mhulse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 84 mhulse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 10 m 24 sec
Reputation Power: 5
DIV ID repeats... Bloated code? HELP!

Hello all,

How can I re-work this:

The test page (For the full effect, manually re-size the window.)

the style sheet

...to validate here:

Validator

Basically, I am trying to make it so I do not have to define the div dimensions/padding/margins/borders for every instance... but the way I have it set-up, the validator does not like repeated div id's...

Does anybody have suggestions for making my code compliant and a bit more streamlined? Javascript? PHP?

I plan to use a simple PHP "for loop" to fill the page with the colored DIVs...

Thanks in advance.
M

Reply With Quote
  #2  
Old June 22nd, 2004, 01:15 PM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,715 Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level)Akh User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 17 h 42 m 44 sec
Reputation Power: 642
the id have to be unique, you can only use it on one element in a document.
http://www.w3.org/TR/html401/struct/global.html#adef-id

instead of the id on each element you could use multiple class or use the cascading in css.

like
#main_container div { /* some style */ }
affects each div within the element #maincontents

or with multiple classes

.c_s { /*some style */}

and in html
<div class="c_s s_ffcccc"></div>

Reply With Quote
  #3  
Old June 22nd, 2004, 02:40 PM
mhulse mhulse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 84 mhulse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 10 m 24 sec
Reputation Power: 5
Ahhh, thank you very much Akh, your suggestions were very helpful! Here is the new code:

HTML

CSS

Validates perfectly:

Validator

Still looking for advice on making the code more dynamic...

This is an interesting example that uses tables and CSS:

Table-art

Thanks!
Cheers,
M

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > DIV ID repeats... Bloated code? HELP!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT