473,661 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Centered CSS

How can I center a page (that uses CSS) so that it has:
- maximum width of 1024
- minimum width of 800
Therefore it should be a liquid design. I haven't found any way in
doing this, not using tables. Yes, it can be done using one table, see
http://www.quirksmode.org/css/centering.html
but is there no way to do it without a table in strict XHTML?

I'm baffled :)
Jul 20 '05 #1
32 2828
Els
Jocab wrote:
How can I center a page (that uses CSS) so that it has:
- maximum width of 1024
- minimum width of 800
Therefore it should be a liquid design. I haven't found any way in
doing this, not using tables. Yes, it can be done using one table, see
http://www.quirksmode.org/css/centering.html
but is there no way to do it without a table in strict XHTML?

I'm baffled :)


Do you want it vertically centered?
The table in abovementioned example is there only for the
vertical centering.
Horizontal centering isn't a problem with css.
Your maximum width of 1024 is your choice, but the minimum
width of 800 will given a scrollbar even in 800x600 screens.
Besides, a lot of people like have their browser windows
smaller than that, even if their screen is bigger.
So don't define a minimum width, unless you have to for some
layout reason, but then make it way less than 800.
--
Els

Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #2
Jocab wrote:
How can I center a page (that uses CSS) so that it has:
- maximum width of 1024
- minimum width of 800
Therefore it should be a liquid design.


That's a strange definition of liquid design. How about designing for
any width?

http://www.allmyfaqs.com/faq.pl?AnySizeDesign

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3
In article Jocab wrote:
How can I center a page (that uses CSS) so that it has:
- maximum width of 1024
- minimum width of 800
Hm. You mean the centered are will have those limits?

html {height:100%;di splay:table;min-width:800px;
max-width:1024px;ma rgin:auto;}
body {display:table-cell;vertical-align:middle;}

Or something like that.

Does not work on IE, but that is probably irrelevant as you use XHTML,
but I don't see any reason for min/max widths in px unit I assumed from
your numbers.
Therefore it should be a liquid design.
No, it wont be. I practically never use 800px or wider browser window. No
problems, exept some idiots that think everybody has at least 800px wide
area in browser where their page would be rendered.

How about those people that use 1600*1200 resolution in their 17" box,
and also 25px normal font size?
I haven't found any way in doing this, not using tables.


I haven't found any reason to do that.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.

Jul 20 '05 #4
On Sun, 22 Feb 2004 22:45:00 GMT, Brian
<us*****@juliet remblay.com.inv alid> wrote:
That's a strange definition of liquid design. How about designing for
any width?

http://www.allmyfaqs.com/faq.pl?AnySizeDesign


Well, let me be a little clearer. What I want is a page with a minimum
resolution of 800 pixels (this is just an example), centered, which
works in IE also. If the width were fixed at 800 px, then it won't be
a problem. But I would like it to have max-width hof let's say 1024 or
1280. Because I have a 1600 screen, and an 800 page looks silly in
such a resolution. Moreover, if I don't set a max (or fixed) width, on
1600 the page is waaaaaaaaay too large and it looks very ugly. Is my
reasoning wrong?
Jul 20 '05 #5
Els

Jocab wrote:
On Sun, 22 Feb 2004 22:45:00 GMT, Brian
<us*****@juliet remblay.com.inv alid> wrote:
That's a strange definition of liquid design. How about designing for
any width?

http://www.allmyfaqs.com/faq.pl?AnySizeDesign

Well, let me be a little clearer. What I want is a page with a minimum
resolution of 800 pixels (this is just an example), centered, which
works in IE also. If the width were fixed at 800 px, then it won't be
a problem. But I would like it to have max-width hof let's say 1024 or
1280. Because I have a 1600 screen, and an 800 page looks silly in
such a resolution. Moreover, if I don't set a max (or fixed) width, on
1600 the page is waaaaaaaaay too large and it looks very ugly. Is my
reasoning wrong?


not really, except for the minimum width :-)
Why don't you use a percentage for the left and right margins?
Let's say 10% on each side, container div of 80% in the
middle. See if that does what you want :-)
In addittion you can set a minimum width of let's say 600px,
but that won't work in IE.

--
Els

Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #6
On Mon, 23 Feb 2004 08:10:03 GMT, Jocab <jo**@jo-nospam.com> wrote:
On Sun, 22 Feb 2004 22:45:00 GMT, Brian
<us*****@juliet remblay.com.inv alid> wrote:
That's a strange definition of liquid design. How about designing for
any width?

http://www.allmyfaqs.com/faq.pl?AnySizeDesign


Well, let me be a little clearer. What I want is a page with a minimum
resolution of 800 pixels (this is just an example), centered, which
works in IE also. If the width were fixed at 800 px, then it won't be
a problem. But I would like it to have max-width hof let's say 1024 or
1280. Because I have a 1600 screen, and an 800 page looks silly in
such a resolution. Moreover, if I don't set a max (or fixed) width, on
1600 the page is waaaaaaaaay too large and it looks very ugly. Is my
reasoning wrong?


Check out the page design at htmldog.com and tell me if it won't work in
all the viewport sizes you listed and then some.
Jul 20 '05 #7
On Mon, 23 Feb 2004 03:49:36 -0500, Neal <ne*****@spamrc n.com> wrote:
Check out the page design at htmldog.com and tell me if it won't work in
all the viewport sizes you listed and then some.


Sure it does. But it has no minimum width. It looks nice in 1600*1200
but my site won't have that much content so won't look nice...
Jul 20 '05 #8
On Mon, 23 Feb 2004 09:37:02 +0100, Els <el*********@ti scali.nl>
wrote:
not really, except for the minimum width :-)
Why don't you use a percentage for the left and right margins?
Let's say 10% on each side, container div of 80% in the
middle. See if that does what you want :-)
In addittion you can set a minimum width of let's say 600px,
but that won't work in IE.


Well wouldn't it be possible to have the left and right navs be fixed
(ie 200px). And the middle content relative? I don't think it is
possible.. I'm talking about a 3-column site, with a min-width of 800
and a max-widht of 1024, centered...
Jul 20 '05 #9
Els
Jocab wrote:
On Mon, 23 Feb 2004 09:37:02 +0100, Els <el*********@ti scali.nl>
wrote:
not really, except for the minimum width :-)
Why don't you use a percentage for the left and right margins?
Let's say 10% on each side, container div of 80% in the
middle. See if that does what you want :-)
In addittion you can set a minimum width of let's say 600px,
but that won't work in IE.

Well wouldn't it be possible to have the left and right navs be fixed
(ie 200px). And the middle content relative? I don't think it is
possible..


I don't see why not?
You are talking about a centered page, in which the left and
righ columns have fixed width, and the middle stretches with
the width of the browser, and the total of the 3 together
are not allowed to exceed 1024px wide.

No problem at all, as long as you don't expect it to stop at
1024px wide in IE.
I'm talking about a 3-column site, with a min-width of 800
and a max-widht of 1024, centered...


Again, the min-width is unrealistic. Even 800x600 screens
can't show 800 wide without a scrollbar.

--
Els

Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1940
by: VRandy | last post by:
Example: http://pages.prodigy.net/randyv/centerprb.htm The desired effect is a fixed width left margin with a fixed width div centered in the right side. If the browser is resized to become very narrow (less than 640px in this example), the right side centered div should stop at the margin and horizontal scroll bar appear as the window gets extremely narrow. IE6 and Opera 4.11 display all the examples the same way. The top row is a...
5
2492
by: Haines Brown | last post by:
I want a centered body, 680px wide, having a red bottom margin. The following works well in galeon, but not in IE5, where the bottom margin steals the full width of the viewpoint. That is, the red line stretches from one side of the screen to the other and is not 680 pixels long. Why isn't the bottom margin 680 pixels? body { ... width: 680px; margin-top: 1em;
7
10112
by: DaWoE | last post by:
Hi, I want to place a div centered of another div in IE. I get this to work in Mozilla, but not in IE. The code i use for mozilla is the following : <html> <head> <style type="text/css">
2
5483
by: David Winter | last post by:
This is a totally trivial CSS problem, I'm sure, but I don't get it. I want a centered DIV with a fixed width between two other DIVs that should fill the rest of the window/viewport (= 100%). How do I achieve this? I tried width:auto for the buffer DIVs, but it didn't work. This should at least work in IE 5.5 and Opera. A totally standards-compliant solution would be appreciated, of course ... :/ This is waht I have:
4
9727
by: Mimo Zus | last post by:
I'm hoping that someone can explain what's going on; better yet provide a workaround. I'm designing a centered CSS site based on a 550 pixel wide vertical background image. Onto this background I built a two column layout with nested navigation and content divs. The background image is centered via "background: ... center;", the divs are centered over it via "margin: 0 auto 0 auto;". The problem I'm having in IE6 is inconsistent...
17
2263
by: Stian Lund | last post by:
Hello, I've been struggling with this problem for a while now, so I though I'd get some input from anyone more skilled with CSS than I am. I'm actually trying to accomplish two things with this: 1. Create a floated image with text around, with a caption centered underneath. Image size can be varied but the caption needs to have a fixed size to make it break correctly I think. I also need the image to resize automatically when the...
6
2224
by: hiervision | last post by:
Hi I have a question about a CSS menu. I've got a 700 pixel table centered in the body of my page. The table scrolls quite a ways down. I would like to place a menu flush against the right side of that table, centered vertically, which does not move when the user scrolls down. Obviously, it would need to stay flush against the centered table as it is resized in either
9
2514
by: Troy Piggins | last post by:
If I use the code: ----- <div style="text-align: center;"> <a href="photos.php?img=xx1.jpg"> <img src="xx1.jpg" style="padding: 10px;" /> </a> <a href="photos.php?img=xx2.jpg">
7
2011
by: TheLongshot | last post by:
I just recently converted a few pages of my application to using master pages. Problem is, in all of my content pages, the contents are centered. I can't figure out why. The markup in the content page seems to ignore any attempts to manually align right. So what's the deal?
3
2314
by: gentsquash | last post by:
I'm trying to display a paragraph that has a centered phrase, such as this one, in the middle of the paragraph. An example is the section "End of semester project" on my course-page http://www.math.ufl.edu/~squash/course.calc3.html
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8855
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8758
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7364
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.