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
I read the centering sticky but....
Old 08-27-2009, 01:36 PM I read the centering sticky but....
Experienced Talker

Posts: 31
Name: Rachel
Trades: 0
I am not sure where I insert the code, do I add it to my style sheet .css document?

This is how my CSS starts:
Quote:
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
background: #fff url(bgfade.jpg) repeat-x;
}
#header {
color: #333;


(with thanks to you guys on here I was able to get my BG image how I wanted-that coupled with my CSS book. Its all starting to make a little bit more sense now.) But centering is confusing me as I cant work out where to put the command.

Thanks!
Rachelsne is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-27-2009, 02:23 PM Re: I read the centering sticky but....
Skilled Talker

Posts: 66
Trades: 0
Well,If you want for all content to be centered in your page, you're going to have to add an id it to your .css.

The thing to do is to create a div, and set it to an id such as "content." Then in your .css, create it so that the id is as something as follows:
#content {
height: 600px;
width: 813px;
margin-right: auto;
margin-left: auto;
padding: 0px;
}

From there, put all other divs within "content" so that it's all centered. The important thing to realize on how to center content is to have the margin-right and margin-left set to "auto."

Make sense?
Mikeface is offline
Reply With Quote
View Public Profile
 
Old 08-27-2009, 03:00 PM Re: I read the centering sticky but....
Experienced Talker

Posts: 31
Name: Rachel
Trades: 0
Thank you, that worked, now just so I can get a better understanding, what does
height: 600px;
width: 813px;
actually refer to?
Rachelsne is offline
Reply With Quote
View Public Profile
 
Old 08-27-2009, 03:49 PM Re: I read the centering sticky but....
Experienced Talker

Posts: 31
Name: Rachel
Trades: 0
I played with changing the values, and I now see what it corresponds too.
Rachelsne is offline
Reply With Quote
View Public Profile
 
Old 08-27-2009, 04:19 PM Re: I read the centering sticky but....
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You want to be careful about nailing down specific heights. I see people do it all the time, and most of the time it's just not necessary. A div will stretch vertically to contain what's in it by default. Setting a fixed height could cause problems.
__________________
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 08-27-2009, 11:20 PM Re: I read the centering sticky but....
Experienced Talker

Posts: 31
Name: Rachel
Trades: 0
Is it ok just to miss the height command out?
Rachelsne is offline
Reply With Quote
View Public Profile
 
Old 08-28-2009, 07:28 AM Re: I read the centering sticky but....
Novice Talker

Posts: 7
Trades: 0
Quote:
Originally Posted by Rachelsne View Post
Is it ok just to miss the height command out?
In most cases, yes, but in tight, controlled layouts, sometimes an absolute height is necessary to avoid different browsers pushing lower content down a little if they render text in different ways.

Try removing it and if it doesn't create a paoblem, then all is well!
stuph is offline
Reply With Quote
View Public Profile
 
Old 08-28-2009, 10:58 AM Re: I read the centering sticky but....
Experienced Talker

Posts: 31
Name: Rachel
Trades: 0
Thanks for all your help!
Rachelsne is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to I read the centering sticky but....
 

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