如何在div标签中居中? [英] How to center content in div tag?

查看:79
本文介绍了如何在div标签中居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTML中,我可以使用< div align =" center"> ;.


如何将< div>中包含的所有内容集中在一起?标签使用XHTML 1.1?


是否有任何新闻组用于XHTML创作?


Olav

解决方案

2004年12月9日星期四19:52:06 +0100,Olav Tollefsen < x@y.com>写道:

在HTML中,我可以使用< div align =" center">。


在HTML 4之前你可以(并且在HTML 4 Transitional中,但除非你有一个时间机器,否则你不需要担心关于从1997年之前的代码转换

)。

如何将< div>中包含的所有内容集中在一起?标签使用XHTML 1.1?


与(x)HTML的任何版本相同的方式实际上

在www上工作。


内联内容通过CSS属性text-align:center;

应用于div本身。

块级别子项通过CSS属性边缘居中 - 左:

auto;和保证金权利:auto;应用于子元素。


IE6需要处于标准模式才能使后者工作。 IE5不支持
支持后者,但不正确地确定了中心阻碍儿童的价值

if text-align:center;已设置为父级。

是否有任何新闻组用于XHTML创作?




这一个。


史蒂夫


" Steve Pugh" < ST *** @ pugh.net>在消息中写道

news:74 ******************************** @ 4ax.com ...

2004年12月9日星期四19:52:06 +0100,Olav Tollefsen < x@y.com>写道:

如何将< div>中包含的所有内容集中在一起?标签使用XHTML 1.1?



与在(x)HTML的任何版本中实际工作在www上的方式相同。

内联内容通过CSS属性text-align:center;
应用于div本身。
块级别子项通过CSS属性margin-left:
auto;和保证金权利:auto;适用于子元素。




因此,它在XHTML 1.1严格< div>中没有直接的等价物。标记为< div

align =" center">?


Olav


2004年12月9日星期四20:52:02 +0100,Olav Tollefsen< x@y.com>写道:

" Steve Pugh" < ST *** @ pugh.net>在消息中写道
新闻:74 ******************************** @ 4ax.com ... < blockquote class =post_quotes> 2004年12月9日星期四19:52:06 +0100,Olav Tollefsen < x@y.com>写道:

如何将< div>中包含的所有内容集中在一起?标签使用XHTML 1.1?



与在(x)HTML的任何版本中实际工作在www上的方式相同。

内联内容通过CSS属性text-align:center;
应用于div本身。
块级别子项通过CSS属性margin-left:
auto;和保证金权利:auto;应用于子元素。



因此,它在XHTML 1.1严格< div>中没有直接的等价物。标签为< div
align =" center">?




如果您不得不问这个,为什么,如果我可能会问,是你打算使用XHTML 1.1

严格?

-

博客| < 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>


In HTML, I could use <div align="center">.

How do I center everything contained in a <div> tag using XHTML 1.1?

Are there any newsgroup for XHTML authoring?

Olav

解决方案

On Thu, 9 Dec 2004 19:52:06 +0100, "Olav Tollefsen" <x@y.com> wrote:

In HTML, I could use <div align="center">.
In pre-HTML 4 you could (and in HTML 4 Transitional, but unless you
have a time machine there''s no need to be worrying about the
transition from pre-1997 code).
How do I center everything contained in a <div> tag using XHTML 1.1?
Same way you would in any of the versions of (x)HTML that actually
work on the www.

Inline content is centered via the CSS property text-align: center;
applied to the div itself.
Block level children are centered via the CSS properties margin-left:
auto; and margin-right: auto; applied to the child elements.

IE6 needs to be in Standards mode for the latter to work. IE5 doesn''t
support the latter but does, incorrectly, center block levele children
if text-align: center; was set on the parent.
Are there any newsgroup for XHTML authoring?



This one.

Steve


"Steve Pugh" <st***@pugh.net> wrote in message
news:74********************************@4ax.com...

On Thu, 9 Dec 2004 19:52:06 +0100, "Olav Tollefsen" <x@y.com> wrote:

How do I center everything contained in a <div> tag using XHTML 1.1?



Same way you would in any of the versions of (x)HTML that actually
work on the www.

Inline content is centered via the CSS property text-align: center;
applied to the div itself.
Block level children are centered via the CSS properties margin-left:
auto; and margin-right: auto; applied to the child elements.



So, it''s no direct equivalent in the XHTML 1.1 strict <div> tag to <div
align="center">?

Olav


On Thu, 9 Dec 2004 20:52:02 +0100, Olav Tollefsen <x@y.com> wrote:

"Steve Pugh" <st***@pugh.net> wrote in message
news:74********************************@4ax.com...

On Thu, 9 Dec 2004 19:52:06 +0100, "Olav Tollefsen" <x@y.com> wrote:

How do I center everything contained in a <div> tag using XHTML 1.1?



Same way you would in any of the versions of (x)HTML that actually
work on the www.

Inline content is centered via the CSS property text-align: center;
applied to the div itself.
Block level children are centered via the CSS properties margin-left:
auto; and margin-right: auto; applied to the child elements.



So, it''s no direct equivalent in the XHTML 1.1 strict <div> tag to <div
align="center">?



If you have to ask that, why, if I may ask, are you going to use XHTML 1.1
strict?
--
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>


这篇关于如何在div标签中居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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