Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



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

Posts: 30
Name: Peter
Trades: 0
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
 
 
Register now for full access!
Old 03-01-2007, 11:45 AM Re: DIV Class within another class
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 12:13 PM Re: DIV Class within another class
Angelosanto's Avatar
Webmaster Talker

Posts: 548
Name: Danny Angelosanto
Trades: 0
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
__________________
"The only reason some people get lost in thought is because it's unfamiliar territory."
_____________________________________
Angelosanto is offline
Reply With Quote
View Public Profile Visit Angelosanto's homepage!
 
Old 03-01-2007, 12:16 PM Re: DIV Class within another class
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 09:31 PM Re: DIV Class within another class
Experienced Talker

Posts: 30
Name: Peter
Trades: 0
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 09:35 PM..
D.O.I.P is offline
Reply With Quote
View Public Profile
 
Old 03-01-2007, 10:04 PM Re: DIV Class within another class
Tom_M's Avatar
Ultra Talker

Posts: 250
Name: Tom Maurer
Location: Pennslvania, USA
Trades: 0
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, 08:35 PM Re: DIV Class within another class
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 03-02-2007, 11:44 PM Re: DIV Class within another class
Tom_M's Avatar
Ultra Talker

Posts: 250
Name: Tom Maurer
Location: Pennslvania, USA
Trades: 0
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-03-2007, 12:11 AM Re: DIV Class within another class
Angelosanto's Avatar
Webmaster Talker

Posts: 548
Name: Danny Angelosanto
Trades: 0
It just makes your code so much more versatile - I'd definitely reccomend it
__________________
"The only reason some people get lost in thought is because it's unfamiliar territory."
_____________________________________
Angelosanto is offline
Reply With Quote
View Public Profile Visit Angelosanto's homepage!
 
Old 03-03-2007, 06:47 AM Re: DIV Class within another class
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-03-2007, 07:21 AM Re: DIV Class within another class
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
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
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Old 03-06-2007, 04:04 AM Re: DIV Class within another class
Experienced Talker

Posts: 30
Name: Peter
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.55513 seconds with 12 queries