CSS盒模型diskai云征途国际app体育网页登录入口play行内块元素/float浮动
属性 | 值 | 说明 | CSS 版本 |
clear | none | 允许两边均可浮动 | 1 |
left | 左边界不得浮动 | 1 | |
right | 右边界不得浮动 | 1 | |
both | 两边都不得浮动 | 1 |
//两边均不可浮动
#c {background: navy;clear: both;}
属性 | 值 | 说明 | CSS 版本 |
float | left | 浮动元素靠左 | 1 |
right | 浮动元素靠右 | 1 | |
none | 禁用浮动 | 1 |
//实现联排效果
#a {background: gray;
float: left;}
#b {background: maroon;float: left;}
#c {background: navy;float: left;}
//实现元素右浮动
#c {background: navy;float: right;}
//取消元素的浮动
#c {background: navy;float: none;}
刚才的浮动有一个问题:当一个元素盒子被浮动后,
3、
2、
//设置元素隐藏,行内- 块元素
所谓行内-块元素,
三、而有些支持度不好或者尚不支持,比如:<div>、不占位 //将行内元素转成块级元素 span {background: silver;width: 200px;height: 200px;display: block;} //将块级元素转换成行内元素 div {background: silver;width: 200px;height: 200px;display: inline;} //将块级元素转化成行内-块元素 div {background: silver;width: 200px;height: 200px;display: inline-block;} //将元素隐藏且不占位 div {display: none;} display 属性还有非常多的值,元素的浮动float1
CSS 盒模型有一种叫浮动盒,元素在页面上可见。下面的元素会自动堆叠处理,可以更改元素本身盒类型。
属性 | 值 | 说明 | CSS 版本 | |||||
display | block | 盒子为块级元素 | 1 | |||||
inline | 盒子为行内元素 | 1 | ||||||
inline-block | 盒子为行内-块元素 | 1 | ||||||
none | 盒子不可见,无法隔离其他元素,比如:、样式表如下:
|