欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 产业 > 前端学习DAY30(水平)

前端学习DAY30(水平)

2025/2/25 11:36:55 来源:https://blog.csdn.net/qq_66645900/article/details/144942871  浏览:    关键词:前端学习DAY30(水平)

子元素是在父元素的内容区中排列的,如果子元素的大小超过了父元素,则子元素会从

        父元素中溢出,使用overflow属性设置父元素如何处理溢出的子元素

        可选值:visible  默认值,子元素会从父元素中溢出,在父元素外部的位置显示

        hidden 溢出的内容将会被裁剪不会显示

        scroll 生成两个滚动条,通过滚动条来查看完整的内容

        auto 根据需要生成滚动条

       

        额外俩个属性(了解)

        overf-x

        overf-y

父元素规定高度范围

        .outer{background-color: chartreuse;height: 300px;}

子元素小于父元素规定高度在父元素范围内

        .inner{width:100px;height: 100px;background-color: blue;margin-bottom: 100px;}

 

 

若父元素没有规定高度,子元素撑开父元素高度(300px)

.outer{background-color: chartreuse;/*  height: 500px;  */}.inner{width:100px;height: 100px;background-color: blue;margin-bottom: 300px;}

完整代码

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>
.outer{background-color: chartreuse;/*  height: 500px;  */}.inner{width:100px;height: 100px;background-color: blue;margin-bottom: 300px;}</style>
</head>
<body><div class="outer"><div class="inner"></div><div class="inner"></div></div>
</body>
</html>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词