CSS--两种盒子模型以及border属性

盒模型(box model)

概述:
margin(-TopRightBottomLeft), padding(-TRBL),border(TRBL+style|color|width), box-sizing width, height, display, visibility

设置背景色或背景图:
background-color, background-image, background-repeat, background-clip,background-origin, background-attachment, background-size, background-position,linear-gradient, repeating-linear-gradient, radial-gradient, repeating-radial-gradient

修饰边框: border-radius,box-shadow,border-image

设置尺寸与溢出:
height,width,box-sizing,max-width,min-width,max-height,overflow,overflow-x,overflow-y

设置浮动元素: float, clear

使用定位技术: position, z-index

垂直对齐: vertical-align

列表样式: list-style-type, list-style-position, list-style-image

表格样式: border-collapse, border-spacing, empty-cells, table-layout

变换、过渡和动画:
transform(skew,scale,rotate,translate,rotate3d),transform-origin
backface-visibility,perspective,perspective-origin
transition(property,duration,delay,timing-function)
animation(name,duration,timing-function,direction,fill-mode,play-state)

内容(content)、内边距(padding)、边框(border)、外边距(margin)
IE盒子模型

这里写图片描述
标准盒子模型

这里写图片描述

padding是内容和其边框线之间的空间, margin是一个元素与另一个元素之间的空白。
width和height默认指内容的宽度和高度。
box-sizing: border-box |padding-box|content-box(默认); //(Firefox: -moz-box-sizing Safari或
chrome或android:-webkit-box-sizing ) -ms- IE
background-color 用颜色填充边框内部的空间,包括padding部分和虚线边框。

在标准的盒子模型中,width指content部分的宽度,在IE盒子模型中,width表示content+padding+border这三个部分的宽度

标准盒子模型的盒子宽度:左右margin+左右border+左右padding+width
IE盒子模型的盒子宽度:左右margin+width

选择标准盒子模型方法:在html模板中加doctype声明。

1

CSS3新增box-sizing属性

box-sizing属性,box-sizing:content-box;表示标准的盒子模型,
box-sizing:border-box表示IE盒子模型。
默认的情况下是标准盒子模型。
border属性

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值