Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is background-color:none valid CSS?

Can anyone tell me if the following CSS is valid?

.class {     background-color:none; } 
like image 776
NarfkX Avatar asked Jan 05 '12 08:01

NarfkX


People also ask

What is background none in CSS?

background-color: red; background-image: url(../img. jpg); background-repeat: no-repeat; background-attachment: fixed; background-position: 0 0; So... when you set: background:none; you are saying that all the background properties are set to none...

Is background color a property in CSS?

The background-color property in CSS is used to specify the background color of an element. The background covers the total size of the element with padding and border but excluding margin. It makes the text so easy to read for the user.

What are valid CSS colors?

The W3C HTML and CSS standards have listed only 16 valid color names: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.

What is the CSS code for background color?

Background-color values can be expressed in hexadecimal values such as #FFFFFF, #000000, and #FF0000. Background-color values can be expressed using rgb such as rgb(255,255,255), rgb(0,0,0), and rgb(255,0,0).


2 Answers

You probably want transparent as none is not a valid background-color value.

The CSS 2.1 spec states the following for the background-color property:

Value: <color> | transparent | inherit

<color> can be either a keyword or a numerical representation of a colour. Valid color keywords are:

aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow

transparent and inherit are valid keywords in their own right, but none is not.

like image 102
James Allardice Avatar answered Oct 22 '22 06:10

James Allardice


No, use transparent instead none . See working example here in this example if you will change transparent to none it will not work

use like .class { background-color:transparent; }


Where .class is what you will name your transparent class.
like image 45
Jitendra Vyas Avatar answered Oct 22 '22 06:10

Jitendra Vyas