Only websafe colours for styling a <hr>?

I have a <hr> and I need it to have the colour (hex value) #ac8900. If I style it the old fashioned way

<hr color="#ac8900">

it works fine. But I'm expected to style everything with CSS, so I tried this in my style sheet:

hr{
color: #ac8900;
background-color: #ac8900;
border-color: #ac8900;
height:2px;
border:none;
}

But it doesn't work. Other, more 'basic' colours work such as #000, #fff etc but not the one I need. Can you only colour a <hr> with css using web safe colours?


Your property values are invalid. you need RGB codes for the values to be valid. Try the below style.

No need of border-color if border:none , Similarly color doesn't make sense here too.

hr{
background-color: #ac8900;
height:2px;
}

See MDN for acceptable values for the CSS color data type. There are a lot of valid ways to specify colors, including three or six digit hexadecimal numbers, rgb() , hsl() , and keywords like red or cornflowerblue .

链接地址: http://www.djcxy.com/p/15758.html

上一篇: PHP:for

下一篇: 只有websafe颜色才能为<hr>造型?