以CSS为中心 [英] Centered CSS

查看:67
本文介绍了以CSS为中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将页面居中(使用CSS)以便它具有:

- 最大宽度1024

- 最小宽度800

因此它应该是液体设计。我没有找到任何方式在

这样做,而不是使用表格。是的,可以使用一个表格完成,请参阅
http:/ /www.quirksmode.org/css/centering.html

但如果没有严格的XHTML表,是不是没办法呢?


我很困惑:)

解决方案

Jocab写道:

如何将页面居中(使用CSS)使它具有:
- 最大宽度为1024
- 最小宽度为800
因此它应该是液体设计。我没有找到任何方式来做这件事,而不是使用表格。是的,可以使用一个表格完成,请参阅
http:/ /www.quirksmode.org/css/centering.html
但如果没有严格的XHTML表格,没有办法做到这一点吗?

我很困惑:)




你想让它垂直居中吗?

上面例子中的表只适用于

垂直居中。

水平居中不是css的问题。

你的最大宽度是你的选择,但是最小的宽度是b $ b即使在800x600的屏幕上,800也会给出一个滚动条。

此外,很多人都喜欢让他们的浏览器窗口小于b
,即使他们的屏幕更大。 />
所以不要定义最小宽度,除非你必须为某些

布局原因,但是然后让它小于800.

-

Els


Sonhos vem。 Sonhos v?o。 Orestoébritfeito。

- Renato Russo -


Jocab写道:

我如何将页面居中(使用CSS)以使其具有:
- 最大宽度为1024
- 最小宽度为800
因此它应该是液体设计。



这是液体设计的一个奇怪定义。如何设计

任何宽度?

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


-

Brian(删除& ;无效从我的地址发送电子邮件给我
http://www.tsmchughs.com /


在文章中Jocab写道:

如何将页面(使用CSS)居中,以便它具有:
- 最大宽度1024
- 最小宽度800


Hm。你的意思是居中会有这些限制吗?


html {身高:100%;显示:表;最小宽度:800px;

最大宽度:1024px; margin:auto;}

body {display:table-cell; vertical-align:middle;}


或类似的东西。


不能在IE上运行,但这可能与你使用XHTML无关,

但是我没有看到px中最小/最大宽度的任何原因单位我从

假设您的数字。

因此它应该是流动的设计。


不,它不会。我几乎从不使用800px或更宽的浏览器窗口。没有

问题,让一些白痴认为每个人在浏览器中都有至少800px宽的价格,而b / b
区域会被呈现。


那些使用1600 * 1200分辨率的人如何?盒子,

和25px普通字体大小?

我没有找到任何方法这样做,不使用表格。




我没有找到任何理由这样做。


-

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·海特? samaa viesti? meilitse ja ryhm ?? n。


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 :)

解决方案

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 -


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/


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%;display:table;min-width:800px;
max-width:1024px;margin: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.


这篇关于以CSS为中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆