背景:无与背景:透明有什么区别? [英] background:none vs background:transparent what is the difference?

查看:138
本文介绍了背景:无与背景:透明有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个CSS属性之间是否存在差异:

Is there a difference between these two CSS properties:

background: none;
background: transparent;

  1. 它们都有效吗?
  2. 应该使用哪个?为什么?

推荐答案

它们之间没有区别.

如果您没有为background的速记形式指定任何六个属性的值,则将其设置为其默认值. nonetransparent是默认设置.

If you don't specify a value for any of the half-dozen properties that background is a shorthand for, then it is set to its default value. none and transparent are the defaults.

一个将background-image显式设置为none,而将background-color隐式设置为transparent.另一回事.

One explicitly sets the background-image to none and implicitly sets the background-color to transparent. The other is the other way around.

这篇关于背景:无与背景:透明有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆