“Pr dim max width”的版本间差异
本页内容
(创建页面,内容为“{{DISPLAYTITLE:max-width}}4 = CSS max-width 属性 = 设置段落的最大宽度: <sample title="" desc="" lang="html" hererun="1"> p { max-width:100px; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> p { max-width:100px; background-color:yellow; } </style> </head> <body> <p>这一段的最大宽度设置为100 px。</p>…”) |
无编辑摘要 |
||
(未显示同一用户的1个中间版本) | |||
第1行: | 第1行: | ||
{{DISPLAYTITLE:max-width}}[[Category:css | {{DISPLAYTITLE:max-width}}[[Category:css reference|97]] | ||
= CSS max-width 属性 = | = CSS max-width 属性 = | ||
第59行: | 第59行: | ||
{| class="table table-striped table-hover" | {| class="table table-striped table-hover" | ||
! 属性 | ! 属性 | ||
! | ! Chrome | ||
! | ! Internet Explorer / Edge | ||
! | ! Firefox | ||
! | ! Safari | ||
! | ! Opera | ||
|- | |- | ||
| max-width | | max-width |
2022年8月19日 (五) 04:45的最新版本
CSS max-width 属性
设置段落的最大宽度:
示例
p
{
max-width:100px;
}
属性定义及使用说明
max-width属性设置元素的最大宽度。
注意: max-width属性不包括填充,边框,或页边距!
默认值: | none |
继承: | no |
版本: | CSS2 |
JavaScript 语法: | object.style.maxWidth="100px" |
浏览器支持
表格中的数字表示支持该属性的第一个浏览器版本号。
属性 | Chrome | Internet Explorer / Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
max-width | 1.0 | 7.0 | 1.0 | 2.0.2 | 7.0 |
属性值
值 | 描述 |
---|---|
none | 默认。定义对元素的最大宽度没有限制。 |
length | 定义元素的最大宽度值。 |
% | 定义基于包含它的块级对象的百分比最大宽度。 |
inherit | 规定应该从父元素继承 max-width 属性的值。 |
相关文章
CSS 教程: CSS Dimension
CSS 参考手册: min-width 属性