[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 05-20-2004, 04:30 PM   #1 (permalink)
NamePros Regular
 
Join Date: May 2004
Posts: 315
43.00 NP$ (Donate)

wistow is an unknown quantity at this point


CSS Alignment problem

Hi

I have been using css since last sunday, and I have learnt it pretty quick.

The problem I am having is that I have a website layout where the content is in a fixed sized layer of 754 pixels. When designing on my monitor which is 1024x768 i give it a 12% indent from the left side of the page and it looks fine as it is centrally aligned, BUT when I test it in 800x600 mode it is all aligned to the right of the page and I am wanting it aligned in the centre of the page on both resolutions.

Do you have any ideas how I could do this? If it is very obvious i am sorry but remember i'm just a newbie!

Kind Regards,

Craig Wistow
HitSnapper.com
wistow is offline  
Old 05-21-2004, 11:35 AM   #2 (permalink)
New Member
 
Join Date: May 2004
Posts: 4
7.00 NP$ (Donate)

radka is an unknown quantity at this point


I am new to css too, but the way I center the layer is:

#layer {
position:absolute;
left:50%;
width:754px;
margin-left: -377px; }

position left:50% will align the left side of your layer with the center of any browser window and margin left (377 is half of your layer width) will move the left side -377 px to the left from the center. That way your layer will be always centered.

Good luck, hope it will help

Radka
radka is offline  
Old 05-21-2004, 11:41 AM   #3 (permalink)
NamePros Regular
 
Join Date: May 2004
Posts: 315
43.00 NP$ (Donate)

wistow is an unknown quantity at this point


Thanks, that would work, but I cured the problem this morning

Thanks for the help though!

Kind Regards,

Craig
wistow is offline  
Old 05-21-2004, 11:49 AM   #4 (permalink)
New Member
 
Join Date: May 2004
Posts: 4
7.00 NP$ (Donate)

radka is an unknown quantity at this point


Did you find different solution?

Radka
radka is offline  
Old 05-21-2004, 12:02 PM   #5 (permalink)
NamePros Regular
 
Join Date: May 2004
Posts: 315
43.00 NP$ (Donate)

wistow is an unknown quantity at this point


Yes i used the following:

body{
text-align-center; background-color: #cccccc
}

#header{
width: 754px;
text-align: left;
margin-left: auto;
margin-right: auto;
}

Kind Regards,

Craig
wistow is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 01:47 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85