| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: May 2004
Posts: 316
![]() | CSS Alignment problem Hi ????: NamePros.com http://www.namepros.com/programming/31200-css-alignment-problem.html 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 Join Date: May 2004
Posts: 4
![]() | 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 |
| |
| | THREAD STARTER #3 (permalink) |
| NamePros Regular Join Date: May 2004
Posts: 316
![]() | Thanks, that would work, but I cured the problem this morning ![]() Thanks for the help though! Kind Regards, Craig
__________________ UK Deal Finder |
| |
| | THREAD STARTER #5 (permalink) |
| NamePros Regular Join Date: May 2004
Posts: 316
![]() | 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
__________________ UK Deal Finder |
| |