当前位置:网站首页>(border-box) The difference between box model w3c and IE
(border-box) The difference between box model w3c and IE
2022-07-31 07:02:00 【Fire orchid】
Mainly look at the advantages, disadvantages and applicable scenarios of these two box models
One, the difference
Box model: Content, padding, margin, border;
The content section of the standard W3C box model contains no other sections.
The content section of the IE box model contains borders and paddings.(IE 6- uses its own model, IE6,7 are weird, 8+ has been synchronized with W3C)
Difference:
- IE's width = border + padding + content (ie: fixed width, adding border or padding will squeeze content inward)
- W3C (standard box model) width = content


With a code comparison demonstration, it is obvious!
content-box (default)border-box
Second, the pros and cons of standard box and IE box
The advantage of standard boxes is that they match the width and height of human-defined elements, but IE boxes are more suitable for layouts and forms.There is a common scenario, such as two divs, each accounting for 50%. Obviously, if you set padding border margin, these two divs will not be on one line.So IE boxes are more suitable for layout.Currently css3 has a property box-sizing that can set the box model category of div.As follows:
box-sizing: conteng-box (standard) | border-box (IE) | inherit
边栏推荐
猜你喜欢
随机推荐
随机数,函数
实现二叉树的基本操作
SSH远程管理
DOM操作案例1-点击,使表格的颜色切换(点击单元格,整行或整列颜色切换)
定位元素之后操作对象
浅析瀑布流布局原理及实现方式
常用命令讲解
DOM-DOM的介绍以及通过方法获取元素
闭包,装饰器,类方法,静态方法,委托属性
快速傅里叶变换(FFT)
群晖NAS配置阿里云盘同步
DNS域名解析服务
浅析v-model语法糖的实现原理与细节知识及如何让你开发的组件支持v-model
shell的脚本的基本用法
自动化测试之unittest框架
cenos7安装cmake-3.22.2
软链接和硬链接画图,以及代码,一级目录的解释,重定向,创建文件,删除文件,创建目录,删除目录,cp、mv命令的使用
性能测试概述
数据库原理作业2 — JMU
js原型详解









