“Pr dim width”的版本间差异

本页内容
上一节: Pr_dim_min_width 下一节: Css3_pr_flex
(创建页面,内容为“{{DISPLAYTITLE:width}}7 = 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; } </sty…”)
 
Neo讨论 | 贡献
无编辑摘要
第76行: 第76行:
{| class="table table-striped table-hover"
{| class="table table-striped table-hover"
! 属性
! 属性
!
! Chrome
!
! Internet Explorer / Edge
!
! Firefox
!
! Safari
!
! Opera
|-
|-
| width
| width

2022年8月19日 (五) 04:32的版本

CSS width 属性

设置一个段落的高度和宽度:


示例

p.ex

    {

    height:100px;

    width:100px;

    }

在此页底部有更多的例子。

属性定义及使用说明

width属性设置元素的宽度。

注意: width属性不包括填充,边框和页边距!

默认值: auto
继承: no
版本: CSS1
JavaScript 语法: object.style.width="50px"

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

属性 Chrome Internet Explorer / Edge Firefox Safari Opera
width 1.0 4.0 1.0 1.0 3.5

属性值

描述
auto 默认值。浏览器可计算出实际的宽度。
length 使用 px、cm 等单位定义宽度。
% 定义基于包含块(父元素)宽度的百分比宽度。
inherit 规定应该从父元素继承 width 属性的值。

更多实例

使用百分比来设置元素的宽度 本例演示如何使用百分比值来设置元素的宽度。

相关文章

CSS 教程: CSS Dimension

CSS 教程: CSS Box model

CSS 参考手册: height 属性

上一节: Pr_dim_min_width 下一节: Css3_pr_flex
此页面最后编辑于2022年8月19日 (星期五) 04:32。