为什么特定的div会居中? [英] why is a particular div being centered?

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

问题描述

http://www.frostjedi.com /terra/scrip...loat-form.html


红色背景的div正在居中,我不知道为什么。

有什么想法吗?


我希望它在左边...

http://www.frostjedi.com/terra/scrip...loat-form.html

The div with red background is being centered and I don''t know why.
Any ideas?

I''d like for it to be on the left...

推荐答案



" yawnmoth" < te ******* @ yahoo.com写了留言

新闻:cc *********************** *********** @ q70g2000 hsb.googlegroups.com ...

"yawnmoth" <te*******@yahoo.comwrote in message
news:cc**********************************@q70g2000 hsb.googlegroups.com...
http://www.frostjedi.com/terra/scrip...loat-form.html


红色背景的div正在居中,我不知道为什么。

有什么想法吗?
http://www.frostjedi.com/terra/scrip...loat-form.html

The div with red background is being centered and I don''t know why.
Any ideas?



它没有居中。它正在堆叠到输入字段右侧

,因为你已将它们两个都悬空了。好吧,相反,输入字段是在左侧浮动的div内的
。如果你看起来真的很近,你会注意到

红色div的顶部位于输入区域的上方(和右侧)。


清除:右边的包含你的违规红色div的div对之前的左浮动元素没有

效果。


这是一些奇怪的标记。你应该仔细研究什么漂浮物

的意思。


-

理查德。

It''s not being centred. It is stacking up to the right of that input field
because you have floated both of them left. Well, rather, the input field is
inside a div that is floated left. If you look real close you will note that
the top of the red div is above (and to the right) of the input field.

The clear: right on the div that contains your offending red div has no
effect on prior left floated elements.

This is some bizarre mark up. You should study up on what float really
means.

--
Richard.


rf写道:
rf wrote:

" yawnmoth"写道:
"yawnmoth" wrote:

> ...有什么想法吗?
>... Any ideas?



这是一个奇怪的标记。你应该仔细研究浮动真正意味着什么。


This is some bizarre mark up. You should study up on what float really
means.



它使用的是XHTML doctype,但是用HTML编写。 : - /


-

-bts

-朋友不要让朋友驾驶Vista

And it''s using an XHTML doctype, but written in HTML. :-/

--
-bts
-Friends don''t let friends drive Vista


2月22日上午6:16,Beauregard T. Shagnasty

< a.nony.m ... @ example.invalidwrote:
On Feb 22, 6:16 am, "Beauregard T. Shagnasty"
<a.nony.m...@example.invalidwrote:

rf写道:
rf wrote:

" yawnmoth"写道:
"yawnmoth" wrote:

...有什么想法吗?
... Any ideas?


这是一个奇怪的标记。你应该仔细研究浮动真正意味着什么。
This is some bizarre mark up. You should study up on what float really
means.



它使用的是XHTML doctype,但是用HTML编写。 : - /


And it''s using an XHTML doctype, but written in HTML. :-/



这是一个有趣的小实验。拿这个页面:

http://www.frostjedi.com/terra/scrip...fox-xhtml.html

根据validator.w3.org完全有效的XHTML。现在在Firefox中查看

页面并将其另存为HTML。例如。文件 - 保存页面为。打开

结果页面并查看它。你会发现它已经不再有效了。

XHTML。并看看它添加到身体背景的垃圾css

属性。


所以我为没有使用有效的XHTML而道歉。我还为

道歉,使用Firefox保存页面以试图隔离问题。哦

好​​吧。 RIP Firefox。


*叹*

Here''s a fun little experiment. Take this page:

http://www.frostjedi.com/terra/scrip...fox-xhtml.html

Perfectly valid XHTML according to validator.w3.org. Now view that
page in Firefox and save it as HTML. eg. File -Save Page As. Open
the resultant page and look at it. You''ll see it''s no longer valid
XHTML. And take a look at the junk it adds to the body background css
property.

So I do apologize for not using valid XHTML. I also apologize for
using Firefox to save a page in an attempt to isolate the problem. Oh
well. RIP Firefox.

*sigh*


这篇关于为什么特定的div会居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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