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
Centering with the div tag
Old 06-04-2007, 12:16 AM Centering with the div tag
Skilled Talker

Posts: 64
Name: Timothy Nerbonne
Trades: 0
Hi. I started trying to customize a css template from Dynamic Drive. I want to have a centered 660px middle frame (or cell, div, box, whatever it's called..). If you look at the example, the sides are a set width and the middle expands to fit the screen resolution of the browser. I want to basically do the opposite. Keep the middle at 660px and expand the sides to fit the screen resolution.

Can anyone tell me how to modify this code to do that?

http://www.dynamicdrive.com/style/la...frames-layout/
nerbonne is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-04-2007, 04:40 AM Re: Centering with the div tag
xprmnt's Avatar
Extreme Talker

Posts: 212
Name: GiorgosK
Location: Geoland.org - Greece
Trades: 0
I am not sure that this is possible, at least not in an easy way

this guy here
http://archivist.incutio.com/viewlist/css-discuss/82491

suggests
'all-float with negative margins' from scratch and place the
main content first.
__________________
GiorgosK
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


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
xprmnt is offline
Reply With Quote
View Public Profile Visit xprmnt's homepage!
 
Old 06-04-2007, 02:08 PM Re: Centering with the div tag
angele803's Avatar
Perfectly Imperfect

Posts: 1,774
Name: Stephanie
Location: Oklahoma
Trades: 2
EDIT - This wont work, I misunderstood what you were trying to do

Last edited by angele803; 06-04-2007 at 02:10 PM..
angele803 is offline
Reply With Quote
View Public Profile
 
Old 06-04-2007, 03:04 PM Re: Centering with the div tag
Novice Talker

Posts: 6
Name: Kasper
Location: Denmark
Trades: 0
If I have understood your question right you want to have a static middle and if somebody has a different screen res the middle will still be centered and the same size, but the space on both sides of the middle will just expand?

Ok, here's how:
Make a div named "container". ALL of your future content need to be WITHIN that div!
In your CSS doc write following:

Quote:
#container { position:relative;
width: The width of ALL of your content (including if you have any boxes etc beside your main content);
margin: auto;
}
What we've just done is to make the space that will contain and center your site and content.

Now we move on to do the middle space:
Make a div named "middle" or something like that. Now in your CSS write following:

Quote:
#middle {width:the width of your main content px;
margin-left: auto;
margin-right: auto;
text-align:center;
background-color:#XXXXXX;
}
Now you have made your main content. You only need to dicide which color you want the background (the space between your main content) to be. Specify that by typing this into your CSS:

Quote:
body {background-color:#XXXXXX; }

Hope this helped

Last edited by CaptainB; 06-04-2007 at 03:36 PM..
CaptainB is offline
Reply With Quote
View Public Profile Visit CaptainB's homepage!
 
Old 06-05-2007, 06:43 PM Re: Centering with the div tag
angele803's Avatar
Perfectly Imperfect

Posts: 1,774
Name: Stephanie
Location: Oklahoma
Trades: 2
That is what I first thought nerbonne wanted, but I think he/she wants 3 columns....The middle a static size, and the two side columns would expand with the users resolution.
Im not really sure how you could do this. What happens if you set a specific width on your midde div in pixels and then set the size of the side columns in percentages??
angele803 is offline
Reply With Quote
View Public Profile
 
Old 06-06-2007, 06:27 PM Re: Centering with the div tag
Novice Talker

Posts: 6
Name: Kasper
Location: Denmark
Trades: 0
Quote:
I think he/she wants 3 columns....The middle a static size, and the two side columns would expand with the users resolution.
That's exactly what this code does
CaptainB is offline
Reply With Quote
View Public Profile Visit CaptainB's homepage!
 
Old 06-07-2007, 06:17 AM Re: Centering with the div tag
xprmnt's Avatar
Extreme Talker

Posts: 212
Name: GiorgosK
Location: Geoland.org - Greece
Trades: 0
CaptainB
I don't think its clear what you are doing ?
Mind elaborating a little, or better yet post the whole code that is working

(its a very interesting problem after all)
__________________
GiorgosK
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


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
xprmnt is offline
Reply With Quote
View Public Profile Visit xprmnt's homepage!
 
Reply     « Reply to Centering with the div tag
 

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