小白教程
所有教程
关于
Search
172.70.100.207
172.70.100.207
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Pr dim width”的源代码
本页内容
上一节:
Pr_dim_min_width
下一节:
Css3_pr_flex
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:width}}[[Category:css reference|100]] = CSS width 属性 = 设置一个段落的高度和宽度: <sample title="" desc="" lang="html" hererun="1"> p.ex { height:100px; width:100px; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> img.normal { height:auto; } img.big { height:120px; } p.ex { height:100px; width:100px; } </style> </head> <body> <img class="normal" src="logocss.gif" width="95" height="84" /><br> <img class="big" src="logocss.gif" width="95" height="84" /> <p class="ex">这个段落的高和宽是 100px.</p> <p>这是段落中的一些文本。这是段落中的一些文本。 这是段落中的一些文本。这是段落中的一些文本。 这是段落中的一些文本。这是段落中的一些文本.</p> </body> </html> </run> 在此页底部有更多的例子。 == 属性定义及使用说明 == width属性设置元素的宽度。 '''注意:''' width属性不包括填充,边框和页边距! {| class="table table-striped table-hover" | 默认值: | auto |- | 继承: | no |- | 版本: | CSS1 |- | JavaScript 语法: | object.style.width="50px" |} == 浏览器支持 == 表格中的数字表示支持该属性的第一个浏览器版本号。 {| class="table table-striped table-hover" ! 属性 ! Chrome ! Internet Explorer / Edge ! Firefox ! Safari ! Opera |- | width | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |} == 属性值 == {| class="table table-striped table-hover" ! 值 ! 描述 |- | auto | 默认值。浏览器可计算出实际的宽度。 |- | length | 使用 px、cm 等单位定义宽度。 |- | % | 定义基于包含块(父元素)宽度的百分比宽度。 |- | inherit | 规定应该从父元素继承 width 属性的值。 |} == 更多实例 == [[try.php?filename=trycss_dim_width_percent|使用百分比来设置元素的宽度]] 本例演示如何使用百分比值来设置元素的宽度。 == 相关文章 == CSS 教程: [[css dimension|CSS Dimension]] CSS 教程: [[css boxmodel|CSS Box model]] CSS 参考手册: [[pr dim height|height 属性]]
返回至“
Pr dim width
”。
上一节:
Pr_dim_min_width
下一节:
Css3_pr_flex