分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

CSS浮动---Float

发布时间:2023-09-06 02:25责任编辑:赖小花关键词:CSS

1.浮动模型也是一种可视化格式模型,浮动的框可以左右移动。直到它的外边缘碰到包含框或者另一个浮动元素的框的边缘。浮动元素不在文档的普通流中,文档的普通流中的元素表现的就像浮动元素不存在一样。

不浮动 <div style="border: solid 5px #0e0; width:300px;"> ???????<div style="height: 100px; width: 100px; background-color: Red;"> ???????</div> ???????<div style="height: 100px; width: 100px; background-color: Green; "> ???????</div> ???????<div style="height: 100px; width: 100px; background-color: Yellow;"> ???????</div> ???</div>

  

//红框左移,覆盖绿框 <div style="border: solid 5px #0e0; width:300px;"> ???????<div style="height: 100px; width: 100px; background-color: Red; ?float:left;"> ???????</div> ???????<div style="height: 100px; width: 100px; background-color: Green;"> ???????</div> ???????<div style="height: 100px; width: 100px; background-color: Yellow;"> ???????</div> ???</div>

  

如果包含块儿太窄无法容纳水平排列的三个浮动元素,那么其它浮动块儿向下移动,,直到有足够的扣减,如果浮动元素的高度不同,那么下下移动的时候可能被卡住

没有足够水平空间 ?<div style="border: solid 5px #0e0; width:250px;"> ???????<div style="height: 100px; width: 100px; background-color: Red; ?float:left;"> ???????</div> ???????<div style="height: 100px; width: 100px; background-color: Green; ?float:left;"> ???????</div> ???????<div style="height: 100px; width: 100px; background-color: Yellow; ?float:left;"> ???????</div> ???</div>

  

卡住了<div style="border: solid 5px #0e0; width:250px;"> ???????<div style="height: 120px; width: 100px; background-color: Red; ?float:left;"> ???????</div> ???????<div style="height: 100px; width: 100px; background-color: Green; ?float:left;"> ???????</div> ???????<div style="height: 100px; width: 100px; background-color: Yellow; ?float:left;"> ???????</div> ???</div>

  

CSS浮动---Float

原文地址:https://www.cnblogs.com/moxuexiaotong/p/10070844.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved