首页 > 其他分享 >【W3学习】CSS Box Model Module Level 3(CSS 盒子模型模块)

【W3学习】CSS Box Model Module Level 3(CSS 盒子模型模块)

时间:2022-11-09 10:56:29浏览次数:51  
标签:Box box Level border 1em padding 2em margin CSS

这个规范描述了 margin 和 padding 属性,它们在 CSS 框内和周围创建间距。

 

 

 

content-box
Refers to the content box or content edge. (In an SVG context, treated as fill-box.)


padding-box
Refers to the padding box or padding edge. (In an SVG context, treated as fill-box.)


border-box
Refers to the border box or border edge. (In an SVG context, treated as stroke-box.)


margin-box
Refers to the margin box or margin edge. (In an SVG context, treated as stroke-box.)


fill-box
Refers to the object bounding box or its edges. (In a CSS box context, treated as content-box.)


stroke-box
Refers to the stroke bounding box or its edges. (In a CSS box context, treated as border-box.)


view-box
Refers to the nearest SVG viewport element’s origin box, which is a rectangle with the width and height of the initial SVG user coordinate system established by the viewBox attribute for that element, positioned such that its top left corner is anchored at the coordinate system origin. (In a CSS box context, treated as border-box.)


Note: When the viewBox includes non-zero min-x or min-y offsets, this origin box does not actually correspond to the visible region rectangle defined by the viewBox!

<visual-box> = content-box | padding-box | border-box
<layout-box> = content-box | padding-box | border-box | margin-box
<paint-box> = content-box | padding-box | border-box | fill-box | stroke-box
<coord-box> = content-box | padding-box | border-box | fill-box | stroke-box | view-box

body { margin: 2em }         /* all margins set to 2em */
body { margin: 1em 2em }     /* top & bottom = 1em, right & left = 2em */
body { margin: 1em 2em 3em } /* top=1em, right=2em, bottom=3em, left=2em */
The last rule of the example above is equivalent to the example below:

body {
  margin-top: 1em;
  margin-right: 2em;
  margin-bottom: 3em;
  margin-left: 2em; /* copied from opposite side (right) */
}
body { padding: 2em }         /* all padding set to 2em */
body { padding: 1em 2em }     /* top & bottom = 1em, right & left = 2em */
body { padding: 1em 2em 3em } /* top=1em, right=2em, bottom=3em, left=2em */
The last rule of the example above is equivalent to the example below:

body {
  padding-top: 1em;
  padding-right: 2em;
  padding-bottom: 3em;
  padding-left: 2em; /* copied from opposite side (right) */
}

 

标签:Box,box,Level,border,1em,padding,2em,margin,CSS
From: https://www.cnblogs.com/facenano/p/16872858.html

相关文章

  • 19个免费好用的CSS代码样式生成器工具
    整理编辑| 杨小爱CSS生成器可以帮助每个开发人员的生活变得轻松,提升工作效率,因为它可以立即实现大部分CSS效果,如阴影、边框、按钮颜色/形状等等。在本文中,我将分享19......
  • 5个可视化 CSS 网格布局生成器
    英文|https://blog.bitsrc.io/top-5-css-grid-layout-generators-f7743f0dfad2翻译|杨小二现代Web应用程序是响应式的。尽管很多CSS库和框架都支持Grid系统,但使用......
  • HTML5+CSS3
    一、HTML基础(一)HTML1、常用浏览器​内核浏览器备注IETridentIE,猎豹,360,百度FireFoxGecko火狐SafariWebkit苹果chrome/operaBlinkchrome/......
  • VirtualBox 下 CentOS7 静态 IP 的配置 → 多次踩坑总结,蚌埠住了!
    开心一刻一个消化不良的病人向医生抱怨:我近来很不正常,吃什么拉什么,吃黄瓜拉黄瓜,吃西瓜拉西瓜,怎样才能恢复正常呢?医生沉默片刻:那你只能吃屎了环境准备VirtualBox......
  • css 文本属性
            ......
  • WPF禁用TextBox右键菜单
    WPF禁用TextBox右键菜单如此做<TextBoxGrid.Row="1"HorizontalAlignment="Right"VerticalAlignment="Bottom"Padding="0055"FontSize="12"x:Name="txtBoxHe......
  • 获取DataGridView中ComboBox列某格的值
    获取DataGridView中ComboBox列某格的值如此获取dgr.Cells["treat_result"].Value.ToString();......
  • CSS框架 --- Windin.css + vite + vue3.0 + Vscode的配置
    前沿:一款轻量级的css库类似于bootstrap的css库但是更轻量不会初始化就全量加载进来  按需加载前端开发中可以减少很多样式代码减少冗余样式代码非常nice!官网......
  • Css 取消连接/图片拖动或者选中_CSS pointer-events
    一、浏览器图片或者连接的默认操作1.默认图片选中拖动 2.默认连接选中拖动  二、CSSpointer-events取消选中和拖动,取消鼠标默认操作加上pointer-events:non......
  • 10 个CSS实现元素居中的方法汇总
    英文|https://javascript.plainenglish.io/10-css-tricks-you-should-know-for-centering-elements-61092d35b659翻译|杨小爱在前端开发工程师的日常生活中,使用CSS使......