代码如下,当给xx加上position:fixed,为什么xx在样式上从占一整行,到只包围了xxx。
<!doctype html><html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /><script src="http://libs.baidu.com/jquery/2.0.0/jquery.js" type="text/javascript"></script><style type="text/css">.xxx{height: 100px;width: 100px;background: red;}.xx{ background: black; padding: 10px; /*position: fixed;*/ left: 100px;}</style></head> <body><div class="xx"> <div class="xxx"> </div></div><script type="text/javascript"></script></body> </html>
position:fixed会脱离文档流
内容被它的子元素撑开
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号