css3背景色渐变属性_背景色(CSS属性)

css3背景色渐变属性

描述 (Description)

This property sets the background-color of an element; it’s good practice to specify a foreground color (color) at the same time, to ensure that conflicts don’t arise with colors or backgrounds that are defined elsewhere.

此属性设置元素的background-color ; 最好同时指定前景色( color ),以确保不会与其他地方定义的颜色或背景发生冲突。

The background of an element is the area covered by the width and height of that element (whether those dimensions are set explicitly, or the content dictates them); it also includes the area covered by padding and borders. A background-color (or background-image) that’s applied to an element will appear beneath the foreground content of that element, and the area covered by the padding and border properties for the element. This coverage area is evident where an element has transparent (or dotted or dashed) borders, and the background is seen beneath the borders (or between the dots). Note that Internet Explorer versions up to and including 6 don’t support transparent borders.

元素的背景是该元素的widthheight覆盖的区域(无论这些尺寸是明确设置的,还是内容决定了它们的大小); 它还包括填充和边框所覆盖的区域。 应用于元素的background-color (或background-image )将出现在该元素的前景内容之下,以及该元素的paddingborder属性覆盖的区域。 该覆盖区域很明显,其中元素具有transparent (或dotteddashed )边框,并且在边框下方(或点之间)可以看到背景。 请注意,Internet Explorer 6或以下版本不支持transparent边框。

Some area of the element in question must be visible if the background-color is to show through. If the element has no intrinsic height (defined either by its content or its dimensions), the background will not be seen. If an element contains only floated children which haven’t been cleared then again the background won’t show, as the element’s height will be zero.

如果要显示background-color则该元素的某些区域必须可见。 如果该元素没有固有高度(由其内容或尺寸定义),则不会看到背景。 如果一个元素仅包含尚未清除的浮动子元素,则背景不会再次显示,因为该元素的高度将为零。

The background of an element isn’t inherited by its children as is commonly thought, it’ just that the background will be visible through the child element’s background as the default value is transparent.

元素的background并不像通常认为的那样被其子元素继承,因为默认值是transparent ,因此background将通过子元素的背景可见。

(Example)

This style rule assigns a white background (#fff) to the element with ID "example" :

此样式规则将白色背景( #fff )分配给ID为"example"的元素:

#example{
  background-color: #fff;
}

(Value)

color takes any valid CSS color value or color keyword.

color采用任何有效CSS颜色值或color关键字。

The keyword transparent sets the background-color to be transparent. This value ensures that the content of any element that’s beneath the current element will be visible through the transparent background. The default for background-color is transparent, so there is no need to specify this value unless you’re overwriting previous definitions.

关键字“ transparentbackground-color设置为透明。 此值确保通过透明背景可见当前元素下方任何元素的内容。 background-color的默认值是transparent ,因此除非您覆盖以前的定义,否则无需指定此值。

Color values can be represented in several different ways in CSS (e.g RGBA color values), and the topic is covered in the CSS Concepts section.

颜色值可以在CSS中以几种不同的方式表示(例如RGBA颜色值),并且CSS概念部分中涵盖了该主题。

翻译自: https://www.sitepoint.com/background-color-css-property/

css3背景色渐变属性

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值