user3310886
user3310886

Reputation: 19

Standards for using '#' with css hex colors?

What is the standard for using # with CSS hex colors? Can it be left off? (It seems to work without the #). Is it different depending on whether it is in a .css file vs inline? What about inside ColdFusion, where # is used for defining variables?

Upvotes: 1

Views: 1865

Answers (2)

Ron Rattie
Ron Rattie

Reputation: 71

In the past I have used a double # if he style was inline inside of a CFOUTPUT tag.

Example:

<ul> <cfoutput query="myquery"> <li><a href="somepage.cfm" style="color:##somevarLinkColor#;">#somevar#</a></li> </cfoutput> </ul>

Upvotes: 3

Nishant Srivastava
Nishant Srivastava

Reputation: 4791

Have a look at this link to know how the color system works and why using only digits also works. I don't see how you will mess up with a # in your code, since that's always going to be part of your style attribute and also will be within "", thus completely non conflicting with the CF code.

Upvotes: 0

Related Questions