栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

初始值和未设置值有什么区别?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

初始值和未设置值有什么区别?

根据您的链接:

unset
是一个CSS值,如果继承了一个属性,则该属性与“继承”相同;如果不继承一个属性,则其属性为“初始”

这是一个例子:

pre {  color: #f00;}.initial {  color: initial;}.unset {  color: unset;}<pre>  <span>This text is red because it is inherited.</span>  <span >[color: initial]: This text is the initial color (black, the browser default).</span>  <span >[color: unset]: This text is red because it is unset (which means that it is the same as inherited).</span></pre>

如果您要覆盖样式表中的某些CSS,但您更希望该值是继承的,而不是设置回浏览器的默认值,那么这种情况就很重要。

例如:

pre {  color: #00f;}span {  color: #f00;}.unset {  color: unset;}.initial {  color: initial;}<pre>  <em>Text in this 'pre' element is blue.</em>  <span>The span elements are red, but we want to override this.</span>  <span >[color: unset]: This span's color is unset (blue, because it is inherited from the pre).</span>  <span >[color: initial]: This span's color is initial (black, the browser default).</span></pre>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/670612.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号