This is a discussion on "centered css site in all screen resolutions" within the Web Page Design section. This forum, and the thread "centered css site in all screen resolutions are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
centered css site in all screen resolutions
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
centered css site in all screen resolutions
Hi, i have recently built a site using html and css.
When i view the site on a screen resolution of 1024px and above it looks fine and the site is centered on the screen. Whoever, when i view the site in 800px by 600px screen res the site moves to the right and you have to scroll over the the right and down to view the page. I have used absolute positioning for all elements of the site images, navigation etc. Is there a way to allow my site to be centered in every screen resolution. I have tried using a container but it didnt work. does my positioning of all the site elements need to be changed in the style sheet to accomodate the container. Thanks Forry |
|
|
|
||||
|
Re: centered css site in all screen resolutions
Is your site wider than 800px? If so, all browsers whose window is smaller than the site in question, will render it to the left with the ability to scroll right.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
|
|
|||
|
Re: centered css site in all screen resolutions
No the site is 800px by 600px.
When its viewed in an 800 by 600 screen res it moves the whole site to the right. its not centered Thanks |
|
||||
|
Re: centered css site in all screen resolutions
Is it possible for you to host the site / send a link? Or if not, post your HTML and CSS.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
|
|
|||
|
Re: centered css site in all screen resolutions
ye sure the link is http://www.3dgardendesign.co.uk/
I have just tried it in all res below my screen res of 1280 by 1024. It looks to me like the site is positioned to absolute position i entered in the css code. It looks like it doesnt move form its position in 1280 on other screen res |
|
|||
|
Re: centered css site in all screen resolutions
Drop the absolute positioning, and use the CSS margin: 0 auto; on your main container.
|
|
|||
|
Re: centered css site in all screen resolutions
Hi, i tried that but still doesnt work.
I dont know if i am doing soemthing wrong in the rest of my css to make the container not work properly This is my style in the css for the container #container { background-color: #232222; padding: 0; margin:0 auto; position: relative; width: 100%; height:: 100%; text-align: center; } In the html i have palced the div at beginning of the body and closed the div at end of the body <body> <div id="container"> Thanks |
|
||||
|
Re: centered css site in all screen resolutions
Drop the position: relative?
__________________
Resources Administrator
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
|
|||
|
Re: centered css site in all screen resolutions
I tried dropping the position relative. still no joy.
I have been told to add a table and contain everything inside the table. I dont really want to go down that road of using tables does anyone have any links on how to design a website that is positioned centered in every screen resolution. Thanks |
|
||||
|
Re: centered css site in all screen resolutions
NO TABLES!
Just try dropping the text-align center bit.
__________________
Resources Administrator
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
|
|||
|
Re: centered css site in all screen resolutions
The auto margins method does work. But you need to understand what you're doing. You can't just apply it to any random box and expect it to work.
|
|
|||
|
Re: centered css site in all screen resolutions
Do u not have to define the width of a div in pxels for margin: 0 auto; to work?
Try changing width: 100%; to width: 800px; Also, your css u have 2 ':' ----> height:: 100%; |
|
|||
|
Re: centered css site in all screen resolutions
You can define the width in any unit (but 100% is obviously useless for centring!).
|
|
||||
|
Re: centered css site in all screen resolutions
Yes I was about to say that, if it's width is 100% in essence it is always centered. But you say you have a large margin to the left?
Quote:
Thanks!
__________________
Resources Administrator
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
|
|||
|
Re: centered css site in all screen resolutions
Don't set your content area a fixed width, make their width in percentage value instead
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|||
|
Re: centered css site in all screen resolutions
Quote:
|
|
|||
|
Re: centered css site in all screen resolutions
I usually do use em for my font size, but I never used them to specify any of my div elements
What's the advantage of using them Mike?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
|
|
|||
|
Re: centered css site in all screen resolutions
Quote:
This function is also provided by browser zoom features, but they zoom everything. The most common reason to want zoom is for reading text more easily, not for blowing up images. Font resizing provides a more efficient use of space than whole-page zoom (plus it's faster and doesn't look as ugly). You don't often see these kinds of layouts, but I really like them. Go to my site, the Badminton Bible, and resize the text. Note how the layout adapts. You can of course use a combination of layout units. I use mostly ems, then px (for image-related layout), and occasionally %. Last edited by MikeHopley; Feb 20th, 2008 at 08:06. |
|
||||
|
Re: centered css site in all screen resolutions
if you aren't used to this type of design and plan on using ems and %'s then this conversion table may be useful for you
__________________
WelshStew Lead Administrator tierney rides tboard - uk site | xtreme wales - extreme clothing If you think I've helped, click the "Thanks" webforumz - facebook | LinkedIn
Last Blog Entry: Web Standards Curriculum Launched (Jul 8th, 2008)
|
|
|||
|
Re: centered css site in all screen resolutions
Quote:
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with different resolutions | dcampbell18 | Starting Out | 5 | May 7th, 2008 05:46 |
| Designing Web Sites For All Screen Resolutions | shinesmithdas | Starting Out | 8 | Nov 17th, 2007 21:27 |
| Background resolutions? | Clarky | Website Planning | 6 | Jul 25th, 2007 21:36 |
| Problem with different resolutions | dawg9 | Web Page Design | 7 | Feb 23rd, 2007 03:04 |