search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

2 answers
Q&A css浮动的问题??
css浮动的问题??
大家讲道理 2016-11-12 13:39:43 Views 1073

0
nbsp;html>




Document



    
    
    
11        字体居中     

我设置了子元素boxBar1 向做浮动,子元素boxBar2没有浮动,理论上他会给boxBar1让出他自己的那一部分呈现在页面上。

1623164253-581ab824d8fb9_articlex.png

这时候我设置了boxBar2宽度和父亲宽度相等。但是我设置了字体居中,字体竟然没有相对于本身800的宽度居中。而是相对于本身宽度减去boxBar1的宽度然后再居中。这是为什么?

Your Answer
submit

2 answers
0

这是一种符合预期的行为,dom元素在排版时,会将浮动元素的位置避开,所以,如果想实现红块完全盖住黄块,就不能用float,可以使用position:absolute来代替

2016-11-12 13:39:59

submit

0

你换一个背景图看看,你会发现图片什么的都盖住了,就字能跑来跑去的

2016-11-12 13:40:17

submit

Popular tool

vc9-vc14 (32+64 bit) runtime library collection (link below)

vc9-vc14 (32+64 bit) runtime library collection (link below)

Download the collection of runtime libraries required for phpStudy installation

VC9 32-bit

VC9 32-bit

VC9 32-bit phpstudy integrated installation environment runtime library

PHP programmer toolbox full version

PHP programmer toolbox full version

Programmer Toolbox v1.0 PHP Integrated Environment

VC11 32-bit

VC11 32-bit

VC11 32-bit phpstudy integrated installation environment runtime library

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use