Reply
DIV Class within another class
Old 03-01-2007, 03:21 AM DIV Class within another class
Experienced Talker

Posts: 30
Name: Peter
Want: To have one DIV class within my main content box that I can repeat across the page and down with a small amount of margin on all sides.

I could just code a new div per box that I want, but that just looks messy. I know it is possible to just code once then repeat, like my content divs, but I can't seem to figure out how.

My page: http://test1.mindkicker.com/games.html
D.O.I.P is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 03-01-2007, 10:45 AM Re: DIV Class within another class
LadynRed's Avatar
Super Moderator

Posts: 6,553
Location: Tennessee
I'm not sure I understand what it is you're talking about. What do you mean by 'repeating a div class' ??? What exactly are you trying to achieve ?
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 11:13 AM Re: DIV Class within another class
Angelosanto's Avatar
Ultra Talker

Posts: 440
Name: Danny Angelosanto
Problem with having just one class for all of them is that you might have trouble with the positioning of them, as you can't use the 'position:' option on just one of them
Angelosanto is offline
Reply With Quote
View Public Profile Visit Angelosanto's homepage!
 
Old 03-01-2007, 11:16 AM Re: DIV Class within another class
LadynRed's Avatar
Super Moderator

Posts: 6,553
Location: Tennessee
Sure you can, it just takes a bit more knowledge of CSS Besides, positioning may be wholly unnecessary.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 08:31 PM Re: DIV Class within another class
Experienced Talker

Posts: 30
Name: Peter
I should remember not to post at 12:30 in the morning. The link shows an image of roughly what I want to achieve.

http://test1.mindkicker.com/images/div.gif

Just imagine the container that says "Games" extending down to contain all of the gray boxes.

Last edited by D.O.I.P : 03-01-2007 at 08:35 PM.
D.O.I.P is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 09:04 PM Re: DIV Class within another class
Tom_M's Avatar
Ultra Talker

Posts: 251
Name: Tom Maurer
Location: Pennslvania, USA
If you want floated elements to stay within a container, you need to clear them at the end. You could add a div at the end. I style a div I use exclusively to clear things.

Code:
div#clear-me {
    clear: both;
}
And then just add it to the end

Code:
<div id="clear-me"></div>
Tom_M is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 07:35 PM Re: DIV Class within another class
LadynRed's Avatar
Super Moderator

Posts: 6,553
Location: Tennessee
Actually, there's no need to add a whole new div just to clear floats. There are many methods, I like this simple method:

.brclear{
clear:both;
height:0;
margin:0;
font-size: 1px;
line-height: 0;
}

Then in my code, I add <br class="brclear" /> where I need it. Semantically it is a tiny bit of extra markup -- but pretty insignificant IMHO.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 10:44 PM Re: DIV Class within another class
Tom_M's Avatar
Ultra Talker

Posts: 251
Name: Tom Maurer
Location: Pennslvania, USA
Nice tip using the <br> tag. Is the height, margin, font and line height required? Or just good practice. Using the <br> tag would make more sense to me.
Tom_M is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 11:11 PM Re: DIV Class within another class
Angelosanto's Avatar
Ultra Talker

Posts: 440
Name: Danny Angelosanto
It just makes your code so much more versatile - I'd definitely reccomend it
Angelosanto is offline
Reply With Quote
View Public Profile Visit Angelosanto's homepage!
 
Old 03-03-2007, 05:47 AM Re: DIV Class within another class
chrishirst's Avatar
Super Moderator

Posts: 13,588
Location: Blackpool. UK
Quote:
Originally Posted by Tom_M View Post
Nice tip using the <br> tag. Is the height, margin, font and line height required? Or just good practice. Using the <br> tag would make more sense to me.
Good design practice.
It prevents the <br> taking up space in the document which may insert an unwanted gap between elements.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-03-2007, 06:21 AM Re: DIV Class within another class
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Hmm, never thought about using <br class="clear" /> as clearing element. I was always using <div class="clear"></div> to achieve it. Brilliant idea - a few bytes saved
__________________
Seo Link Directory | Kurs C++ | Forum C++
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Old 03-06-2007, 03:04 AM Re: DIV Class within another class
Experienced Talker

Posts: 30
Name: Peter
I found a way of correcting my problem without having to bother with a new div for clearing floats.

http://www.tipclique.com/tutorial/cs...-clear-floats/

Thanks for all of your tips!
D.O.I.P is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to DIV Class within another class
 

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.17958 seconds with 12 queries