Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Ezilon Directory   Perfect Money   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 01-26-2007, 06:34 AM   #1 (permalink)
Inactive
 
mess_alex's Avatar
 
Join Date: 05-25-06
Location: Poland
Posts: 22
iTrader: 0 / 0%
Latest Blog:
None

mess_alex is liked by many
Send a message via Skype™ to mess_alex
[css] How to center this site?

Hello,

I want to create a site in which widths will be declared in em units. I've done this before but now it's a bigger problem.

Here's the auxiliary image. Menu (with brown background) outlined with blue border will have position: absolute;
My question is: How to center this site? (I'll certainly add a DIV which will contain the whole site - except the menu)
Adding text-align: center to BODY doesn't help. I can use neither margin: 0 auto nor position: absolute; left: 50%; margin-left: -something, because it's impossible to declare width (cannot add px to em).

Best Regards, Aleksander Łaba
mess_alex is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 01-26-2007, 10:42 AM   #2 (permalink)
v7n Mentor
 
Taltos's Avatar
 
Join Date: 11-22-06
Location: Phoenix, AZ
Posts: 1,788
iTrader: 0 / 0%
Latest Blog:
None

Taltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web pro
Send a message via Yahoo to Taltos
Hi Alex,

What do you get when you try? Got a link for us to look at? It is usually much easier to help if we can look at a link and see the problem and view the source.

From your general description, it seems like you should be able to create a div that contains the whole site and use the margin: 0 auto in the CSS for it. Obviously that doesn't work or you wouldn't be posting. Need to be able to see the div structure and the CSS for those div's to know where to help.

Good Luck
__________________
Experimenting
Taltos is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-27-2007, 08:22 AM   #3 (permalink)
Inactive
 
mess_alex's Avatar
 
Join Date: 05-25-06
Location: Poland
Posts: 22
iTrader: 0 / 0%
Latest Blog:
None

mess_alex is liked by many
Send a message via Skype™ to mess_alex
Hi Taltos,

I don't have the code yet.
I'm not having a problem with code, for now I'm only asking for theoretical help - which means a idea for centering the site.

I can't use margin: 0 auto, because I can't declare width for the DIV that will contain the whole page. It's impossible to add pixels to ems.
mess_alex is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-27-2007, 09:09 AM   #4 (permalink)
Contributing Member
 
Join Date: 07-22-06
Location: Denver, Colorado, USA
Posts: 495
iTrader: 0 / 0%
Latest Blog:
None

jumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nice
I guess maybe I'm missing something. Why would you need to add pixels to ems? If you are using ems, why use pixels at all?

You should text-align:center the body(for IE) and margin:0 auto the main div that the page will reside in. You should set the width of the main div using em units.
jumpenjuhosaphat is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-27-2007, 09:50 AM   #5 (permalink)
Inactive
 
Join Date: 12-07-06
Location: Nelson
Posts: 65
iTrader: 0 / 0%
Latest Blog:
None

Gannyaa is a jewel in the roughGannyaa is a jewel in the roughGannyaa is a jewel in the roughGannyaa is a jewel in the roughGannyaa is a jewel in the roughGannyaa is a jewel in the rough
This is what I use in my CSS - mess_alex

[quote]body {
height: auto !important;
background-position: top center;
font-family: "Arial";
font-size: 11px;
color:#000;
padding:0px;
margin:0px;
}
#container {
width: 800px;
height: auto !important;
margin-left: auto;
margin-right: auto;
}[quote]

Hope that helps you. You may have to convert the em to px; although you can declare line height with em.

If you want check out my friend's art site, this is how I do a similar layout.
http://wynston.no-ip.biz/
Gannyaa is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-27-2007, 10:36 AM   #6 (permalink)
Inactive
 
mess_alex's Avatar
 
Join Date: 05-25-06
Location: Poland
Posts: 22
iTrader: 0 / 0%
Latest Blog:
None

mess_alex is liked by many
Send a message via Skype™ to mess_alex
Quote:
Originally Posted by jumpenjuhosaphat View Post
Why would you need to add pixels to ems? If you are using ems, why use pixels at all?
Because of the fluid layout I want to create (the page would expand and contract while changing the font size). And I can't use ems for left column because there will be photo which is only 230px width.

@Gannyaa, again margin: 0 auto won't help. But thanks for taking time to reply.

// EDIT

The topic has expired, at least for me. I've received an information according to which I have to build the site in a different way. But anyway, I'll appreciate if anyone gives the answer.

Last edited by mess_alex : 01-27-2007 at 11:02 AM. Reason: Expiration of topic
mess_alex is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-27-2007, 11:11 AM   #7 (permalink)
Contributing Member
 
Join Date: 07-22-06
Location: Denver, Colorado, USA
Posts: 495
iTrader: 0 / 0%
Latest Blog:
None

jumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nicejumpenjuhosaphat is just really nice
You can use ems to scale the photo. So when you place the photo, you would do it with a width in ems instead of pixels. You could use ems for every element--horizontal or vertical--on a web page. If the parent element has a font size of 10em, then set the image width to 23em. If you haven't set the size of the parent element, ie. the body, then take a guess and adjust the image until it looks the way that you want. Then if the page size is changed, the image will scale also.
jumpenjuhosaphat is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-27-2007, 01:11 PM   #8 (permalink)
v7n Mentor
 
Taltos's Avatar
 
Join Date: 11-22-06
Location: Phoenix, AZ
Posts: 1,788
iTrader: 0 / 0%
Latest Blog:
None

Taltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web pro
Send a message via Yahoo to Taltos
Sounds like it doesn't matter now but I have a fluid layout site where the containing div does not have a specified width. I use the margin-left:auto and margin-right: auto. Same as margin: 0 auto. It works fine. I don't think you would have had a problem. The one difference between your planned layout and mine is that my 1st column has a defined pixel width and my second column has no defined width. Sounds like you were planning to define your second column in em's.
__________________
Experimenting
Taltos is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
your life center of it.. potchie Forum Lobby 17 12-23-2007 11:56 AM
Media Center PC kwvarga Computers & Internet 4 11-22-2007 02:42 AM
How do you center a web page? factoring Coding Forum 10 06-16-2007 06:29 AM
Help Center Live schweermo Web Hosting Forum 1 09-07-2006 02:44 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 07:54 AM.
© Copyright 2008 V7 Inc