CSS中的colorbackground-color有什么区别?

html-css010

CSS中的colorbackground-color有什么区别?,第1张

楼上的说得很对,功能嘛,那导航栏那边,在CSS时写a:link

{

color:redbackgournd-color:#fff}

a:hover

{

color:bluebackgournd-color:#ooo}意思是:当你看到导航时里面的文字是红色,背景颜色是白色,第二个是当你把光标移到导航时字体变蓝色,背景变黑色

css 里 color 属性能继承的,首先需要理解父级元素的概念,就像是div包裹着p或者是其他的一些标签,这些颜色都是可以的继承的,不过对于有些标签是继承不了的,如a标签,就需要去手动改,具体可以看下代码:

<html>

<head>

<style>

#round{

color:#f00 //红色

}

a{

color:#0f0 //绿色 需要单独设置

}

</style>

</head>

<body>

<div id="round">

<p>测试文字1</p>

<p>测试文字2</p>

<a href=''>测试</a>

</div>

</body>

</html>

CSS linear-gradient() 函数用于创建一个表示两种或多种颜色线性渐变的图片。其结果属于<gradient>数据类型,是一种特别的<image>数据类型。

linear-gradient( [ <angle>| to <side-or-corner>,]? <color-stop-list>)

  \---------------------------------/ \----------------------------/

    Definition of the gradient line        List of color stops 

where <side-or-corner>= [ left | right ] || [ top | bottom ]

  and <color-stop-list>= [ <linear-color-stop>[, <color-hint>? ]? ]#, <linear-color-stop>

  and <linear-color-stop>= <color>[ <color-stop-length>]?

  and <color-stop-length>= [ <percentage>| <length>]{1,2}

  and <color-hint>= [ <percentage>

栗子:

div {

  background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet)

}