- CSS 教程
- CSS 简介
- CSS 选择器
- CSS 默认值
- CSS 注释
- CSS 字体
- CSS 字号
- CSS 单位
- CSS 颜色
- CSS 背景
- CSS 高级教程
- CSS 动画
- CSS 伪类
- CSS 伪元素
- CSS 计数器
- CSS 特异位
- CSS 清除浮动
- CSS 图像精灵
- CSS 性能优化
- CSS 属性
- CSS align-content
- CSS align-items
- CSS align-self
- CSS all
- CSS animation
- CSS animation-delay
- CSS animation-direction
- CSS animation-duration
- CSS animation-fill-mode
- CSS animation-iteration-count
- CSS animation-name
- CSS animation-play-state
- CSS animation-timing-function
- CSS backface-visibility
- CSS background
- CSS background-attachment
- CSS background-blend-mode
- CSS background-clip
- CSS background-color
- CSS background-image
- CSS background-origin
- CSS background-position
- CSS background-repeat
- CSS background-size
- CSS border
- CSS border-bottom
- CSS border-bottom-color
- CSS border-bottom-left-radius
- CSS border-bottom-right-radius
- CSS border-bottom-style
- CSS border-bottom-width
- CSS border-collapse
- CSS border-color
- CSS border-image
- CSS border-image-outset
- CSS border-image-repeat
- CSS border-image-slice
- CSS border-image-source
- CSS border-image-width
- CSS border-left
- CSS border-left-color
- CSS border-left-style
- CSS border-left-width
- CSS border-radius
- CSS border-right
- CSS border-right-color
- CSS border-right-style
- CSS border-right-width
- CSS border-spacing
- CSS border-style
- CSS border-top
- CSS border-top-color
- CSS border-top-left-radius
- CSS border-top-right-radius
- CSS border-top-style
- CSS border-top-width
- CSS border-width
- CSS bottom
- CSS box-shadow
- CSS box-sizing
- CSS caption-side
- CSS caret-color
- CSS @charset
- CSS clear
- CSS clip
- CSS clip-path
- CSS color
- CSS column-count
- CSS column-fill
- CSS column-gap
- CSS column-rule
- CSS column-rule-color
- CSS column-rule-style
- CSS column-rule-width
- CSS column-span
- CSS column-width
- CSS columns
- CSS content
- CSS counter-increment
- CSS counter-reset
- CSS cursor
- CSS direction
- CSS display
- CSS empty-cells
- CSS filter
- CSS flex
- CSS flex-basis
- CSS flex-direction
- CSS flex-flow
- CSS flex-grow
- CSS flex-shrink
- CSS flex-wrap
- CSS float
- CSS font
- CSS @font-face
- CSS font-family
- CSS font-kerning
- CSS font-size
- CSS font-size-adjust
- CSS font-stretch
- CSS font-style
- CSS font-variant
- CSS font-weight
- CSS grid
- CSS grid-area
- CSS grid-auto-columns
- CSS grid-auto-flow
- CSS grid-auto-rows
- CSS grid-column
- CSS grid-column-end
- CSS grid-column-gap
- CSS grid-column-start
- CSS grid-gap
- CSS grid-row
- CSS grid-row-end
- CSS grid-row-gap
- CSS grid-row-start
- CSS grid-template
- CSS grid-template-areas
- CSS grid-template-columns
- CSS grid-template-rows
- CSS height
- CSS hyphens
- CSS @import
- CSS justify-content
- CSS @keyframes
- CSS left
- CSS letter-spacing
- CSS line-height
- CSS list-style
- CSS list-style-image
- CSS list-style-position
- CSS list-style-type
- CSS margin
- CSS margin-bottom
- CSS margin-left
- CSS margin-right
- CSS margin-top
- CSS max-height
- CSS max-width
- CSS @media
- CSS min-height
- CSS min-width
- CSS object-fit
- CSS object-position
- CSS opacity
- CSS order
- CSS outline
- CSS outline-color
- CSS outline-offset
- CSS outline-style
- CSS outline-width
- CSS overflow
- CSS overflow-x
- CSS overflow-y
- CSS padding
- CSS padding-bottom
- CSS padding-left
- CSS padding-right
- CSS padding-top
- CSS visibility
- CSS white-space
- CSS width
- CSS word-break
- CSS word-spacing
- CSS word-wrap
- CSS writing-mode
- CSS z-index
- CSS 参考手册
CSS 默认值
在 CSS 中,每个属性都有一个默认值,这些默认值定义了在没有显式样式规则或者继承的情况下,元素将如何显示。下面是一些常见的 CSS 属性及其默认值:
1、字体相关属性:
font-family:浏览器或用户代理的默认字体。
font-size:浏览器或用户代理的默认字体大小。
font-weight:normal(400)。
font-style:normal。
line-height:normal。
2、文本相关属性
color:依赖于浏览器和用户代理设置,默认为黑色。
text-align:left。
text-decoration:none。
text-transform:none。
3、背景相关属性
background-color:透明(transparent)。
background-image:无。
background-repeat:repeat。
background-position:0% 0%。
4、边框相关属性:
border-width:medium(通常是3px)。
border-style:none。
border-color:依赖于用户代理的默认值。
5、盒子模型相关属性:
margin:0。
padding:0。
width:auto。
height:auto。
display:取决于元素类型,默认情况下是inline或block。
6、定位和布局属性:
position:static。
top、right、bottom、left:auto(在静态定位下)。
float:none。
clear:none。
7、列表相关属性:
list-style-type:disc。
list-style-position:outside。
list-style-image:none。
8、表格相关属性:
border-collapse:separate。
border-spacing:0。
这些默认值可能会因浏览器、用户代理或 CSS 重置而略有不同。理解 CSS 属性的默认值对于创建和调整样式非常重要,因为它们形成了没有显式指定样式时的基础。