Is it possible to define a color in CSS by its name plus an alpha transparency value?
I.e.:
#mytext { color: red 0.5 }
rather than resorting to rgba like
#mytext { color: rgba(255,0,0,0.5) }
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can achieve the result you want this way:
Note that opacity will affect the whole element, not just the text, so for example, if the #mytext element had a background color, that would also receive the opacity value of 0.5
However, I agree with Dai, using color names instead of hex or rgb codes isn’t something you should rely on too much. It’s an ugly color palette to work with.