如何将没有边框的固定宽度的盒子居中 [英] How to centre a fixed-width box without border

查看:96
本文介绍了如何将没有边框的固定宽度的盒子居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个700px宽的居中表。我想使用CSS而不是

表。以下是最好的,相对标准兼容的方式

对于非专家来说,内容居中将会被IE5.5主浏览器正确呈现

? br />

如果你将0表示为一个值,是否必须跟随px或em

等,还是可以将其保留为0?


< div style =" text-align:center;">

< div style =" width:700px; margin:0px

auto; text-align:left; padding:10px; border:0px;">

< / div>

< / div>


谢谢

Dave

Hi,

I have a centred table 700px wide. I''d like to use CSS instead of a
table. Is the following the best, relatively standards compliant way
for a non-expert to have content centred that will be rendered right
by the main browsers incl IE5.5?

And if you state 0 as a value, does it have to be followed by px or em
etc or can it be left just as 0?

<div style="text-align:center;">
<div style="width:700px;margin:0px
auto;text-align:left;padding:10px;border:0px;">
</div>
</div>

Thanks
Dave

推荐答案

2005年2月13日14:17:14 -0800,Dave< ze ******** @ yahoo.com.au>写道:
On 13 Feb 2005 14:17:14 -0800, Dave <ze********@yahoo.com.au> wrote:
以下是最好的,相对标准兼容的方式
非专家的内容集中,将由主浏览器正确呈现
包括IE5.5?


专家与否与正确的做事方式无关。

如果你将0作为一个值,那么它必须跟着px或em
等,或者它可以保留为0?


零长度不需要单位定义。

< div style =" text-align:center;">


text-align:旨在与内联元素一起使用。 div不是

内联元素。

使用margin:0 auto;正如你所做的那样,div将自己居中。

< div style =" width:700px; margin:0px
auto; text-align:left; padding:10px; border: 0px;">
Is the following the best, relatively standards compliant way
for a non-expert to have content centred that will be rendered right
by the main browsers incl IE5.5?

Expert or not has nothing to do with the correct way to do things.
And if you state 0 as a value, does it have to be followed by px or em
etc or can it be left just as 0?

A length of zero needs no unit defined.
<div style="text-align:center;">
text-align: is intended to be used with inline elements. A div is not an
inline element.
Use the margin:0 auto; as you do and the div will center itself.
<div style="width:700px;margin:0px
auto;text-align:left;padding:10px;border:0px;">




最好将这些样式放在单独的样式表中,并且:阅读液体

design(< http ://www.google.com/search?q = liquid + design>

-

, - - < - @ - PretLetters:' 'woiest wyf'',遇见了vele interesses:----------。

| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |

| webontwerp | http:// home .wanadoo.nl / b.de.zoete / html / webontwerp.html |

| zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |

` ------------------------------------------- ------- - < - @ ------------''



Best put these styles in a seperate stylesheet and also: read up on liquid
design (<http://www.google.com/search?q=liquid+design>
--
,-- --<--@ -- PretLetters: ''woest wyf'', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------''


Barbara de Zoete写道:
Barbara de Zoete wrote:
2005年2月13日14:17:14 -0800,Dave< ze ******** @ yahoo.com.au>写道:
On 13 Feb 2005 14:17:14 -0800, Dave <ze********@yahoo.com.au> wrote:
< div style =" text-align:center;">
<div style="text-align:center;">



text-align:旨在与内联元素一起使用。 div不是内联元素。


text-align: is intended to be used with inline elements. A div is not
an inline element.




你在这里迷了我。

http://www.htmlhelp.com/reference/cs...ext-align.html


适用于:块级元素


" text-align属性可应用于块-level元素(P,H1,

等),用于对齐元素的文本。


这是否已弃用,以及没有注明,有吗? (是的,我看到

的版权日期。)


-

Blinky Linux注册用户297263


谁实施了Usenet解决方案#45933:

现在杀死所有来自Google网上论坛的帖子



You lost me here.

http://www.htmlhelp.com/reference/cs...ext-align.html

"Applies to: Block-level elements"

"The text-align property can be applied to block-level elements (P, H1,
etc.) to give the alignment of the element''s text."

Is this deprecated, and not noted as such, there? (Yes, I see the
copyright date.)

--
Blinky Linux Registered User 297263

Who has implemented Usenet Solution #45933:
Now killing all posts made from Google Groups


在comp.infosystems中.http:// rel=\"nofollow\" href=\"http://www.authoring.stylesheets\" target=\"_blank\"> www.authoring.stylesheets ,Barbara de Zoete写道:
in comp.infosystems.www.authoring.stylesheets, Barbara de Zoete wrote:
2005年2月13日14:17:14 -0800,Dave< ze ******** @ yahoo.com.au>写道:
On 13 Feb 2005 14:17:14 -0800, Dave <ze********@yahoo.com.au> wrote:
以下是最好的,相对标准兼容的方式
非专家的内容集中,将由主浏览器正确呈现
包括IE5.5?
Is the following the best, relatively standards compliant way
for a non-expert to have content centred that will be rendered right
by the main browsers incl IE5.5?


专家与否与正确的做事方式无关。


正确。

零长度不需要定义单位。

Expert or not has nothing to do with the correct way to do things.
Correct.
A length of zero needs no unit defined.

< div style =" text-align:center;">
text-align:用于内联元素。 div不是
内联元素。
使用margin:0 auto;就像你一样,div会居中。
<div style="text-align:center;">
text-align: is intended to be used with inline elements. A div is not an
inline element.
Use the margin:0 auto; as you do and the div will center itself.




是的。但他确实说过IE5.5。
http:// dorward .me.uk / www / center /#ie

最好把这些款式放在一个单独的样式表中,并且:阅读液体
设计(< http:// www.google.com/search?q=liquid+design>



Yes. But he did say IE5.5.
http://dorward.me.uk/www/centre/#ie
Best put these styles in a seperate stylesheet and also: read up on liquid
design (<http://www.google.com/search?q=liquid+design>




-

Lauri Raittila< http:// www。 iki.fi/lr>< http://www.iki.fi/zwak/fonts>

乌得勒支,NL。



--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.


这篇关于如何将没有边框的固定宽度的盒子居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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