| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Regular | 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 |
| |
| | #2 (permalink) |
| New Member | 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 |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |