jwcane Posted April 23, 2014 Share Posted April 23, 2014 If it is possible to assign a unique name to a custom color on a style sheet, would like to see an example.n Thanks. Link to comment Share on other sites More sharing options...
Ingolme Posted April 23, 2014 Share Posted April 23, 2014 CSS doesn't have any functionality like that. I would recommend using only the basic color names and use color codes for everything else. I don't trust that color names like "Aquamarine" or "LawnGreen" will always work. Standard color names according to W3Schools. aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow. Link to comment Share on other sites More sharing options...
davej Posted April 24, 2014 Share Posted April 24, 2014 I am not familiar with any way to do that, although you can certainly add a /*comment*/ to remember what color it is, and I do that regularly. I think there is an proposed CSS3 way to create variables -- but it is not yet real. http://dev.w3.org/csswg/css-variables/ https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables Link to comment Share on other sites More sharing options...
jwcane Posted April 25, 2014 Author Share Posted April 25, 2014 Thanks Dave, and I'm doing the comments already. It works ok, but variables will be welcome. Link to comment Share on other sites More sharing options...
davej Posted April 25, 2014 Share Posted April 25, 2014 I have heard that this can be accomplished with a CSS preprocessor such as SASS or LESS, but I don't know anything about these. Link to comment Share on other sites More sharing options...
wphigh Posted April 29, 2014 Share Posted April 29, 2014 Why not using class attribute? for instance: .red { color: red;} Then add .red class to your wanted elements. Link to comment Share on other sites More sharing options...
dsonesuk Posted April 29, 2014 Share Posted April 29, 2014 Don't use specific class name for a specific colour, cause if you have to change it! to latest fashionable colour (purple becomes the new red) you will have to change the class name, or cause confusion. .fontstyle01{color: red;} .fontstyle01{color: purple;} Link to comment Share on other sites More sharing options...
Obi1-Cannabis Posted April 29, 2014 Share Posted April 29, 2014 according to this page: http://caniuse.com/css-variables the use of css variables will be available on firefox when they lauch version 31 for other browsers it seems like there's no info about whem they'll support this functionality Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now