徐州建站网站模板,php网站开发实例教程作业,建网站云空间,拼多多seo怎么优化前面的话 在CSS中#xff0c;有4个关键字理论上可以应用于任何的CSS属性#xff0c;它们是initial(初始)、inherit(继承)、unset(未设置)、revert(还原)。而all的取值只能是以上这4个关键字。本文将介绍initial、inherit、unset、revert和all initial 表示元素属性的初始默认…前面的话 在CSS中有4个关键字理论上可以应用于任何的CSS属性它们是initial(初始)、inherit(继承)、unset(未设置)、revert(还原)。而all的取值只能是以上这4个关键字。本文将介绍initial、inherit、unset、revert和all initial 表示元素属性的初始默认值(该默认值由官方CSS规范定义) 兼容性: IE不支持 [注意]关于各属性的初始默认值移步至此 //display在官方CSS规范中定义的默认值是inline
style
.test{display: initial;}
/style
div classbox
div classtest测试一/divspan文字/span
br
div 测试二/divspan文字/span
/div styleline-height: 1.5; width: 100%; height: 80px; srchttps://demo.xiaohuochai.site/css/base/b6.html frameborder0 width320 height240
inherit 表示元素的直接父元素对应属性的计算值 兼容性: IE7-不支持 style
.box{
border: 1px solid black;
padding: 10px;
width: 100px;
}
.test{
border: inherit;
height: 30px;
}
/style
div classbox
div classtest测试一/div
/div
div classbox
div classin
div classtest测试二/div
/div
/div stylewidth: 100%; height: 130px; srchttps://demo.xiaohuochai.site/css/base/b7.html frameborder0 width320 height240 unset unset相对于initial和inherit而言相对复杂一点。表示如果该属性默认可继承则值为inherit否则值为initial。实际上设置unset相当于不设置 兼容性: IE不支持safari9-不支持ios9.2-不支持android4.4.4-不支持
【常用默认可继承样式】 color
cursor
direction
font
letter-spacing
line-height
list-style
text-align
text-indent
text-shadow
text-transform
white-space
word-break
word-spacing
word-wrap
writing-mode //内容为测试一的元素和内容为测试二的元素的样式是一样的
style
.box{
border: 1px solid black;
padding: 10px;
width: 100px;
color: red;
}
.test1{
border: unset;
color: unset;
}
/style
div classbox
div classtest测试一/div
div测试二/div
/div stylewidth: 100%; height: 80px; srchttps://demo.xiaohuochai.site/css/base/b8.html frameborder0 width320 height240 revert 表示样式表中定义的元素属性的默认值。若用户定义样式表中显式设置则按此设置否则按照浏览器定义样式表中的样式设置否则等价于unset 兼容性: 只有safari9.1 和ios9.3 支持 all 表示重设除unicode-bidi和direction之外的所有CSS属性的属性值取值只能是initial、inherit、unset和revert 兼容性: IE不支持safari9-不支持ios9.2-不支持android4.4-不支持 style
.test{
border: 1px solid black;
padding: 20px;
color: red;
}
.in{
/* all: initial;
all: inherit;
all: unset;
all: revert; */
}
/style
div classtest
div classin测试文字/div
/div 【1】当all:initial时.in的所有属性都取默认值 border:none;padding:0;color:black; 【2】当all:inherit时.in的所有属性都取父元素继承值 border:1px solid black;padding:20px;color:red; 【3】当all:unset时.in的所有属性都相当于不设置值默认可继承的继承不可继承的保持默认值 border:none;padding:0;color:red; stylewidth: 100%; height: 220px; srchttps://demo.xiaohuochai.site/css/base/b9.html frameborder0 width320 height240
更多专业前端知识请上
【猿2048】www.mk2048.com