Why doesn't it make a difference when you don't put a # when doing hex codes? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why doesn't it make a difference when you don't put a # when doing hex codes?

Or at least it didn't for me!

17th Apr 2017, 2:08 AM
One Puncher
One Puncher - avatar
8 Answers
+ 8
The only right way to write an hexadecimal color code in Html/Css is to prepend the value with the '#'... Because of Html ( and browsers ) permissivity, you can have the lucky that the browser correct your code, but you cannot be sure that will be the case with any other browser, or during time in future ^^ https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
17th Apr 2017, 5:04 AM
visph
visph - avatar
+ 2
No, but that's because I was trying to make it black but instead of doing 000000 I accidentally did 777777, making it grey which I kept because it looks better.
17th Apr 2017, 2:49 AM
One Puncher
One Puncher - avatar
+ 1
So 'cause what I was writing wasn't a number?
17th Apr 2017, 2:12 AM
One Puncher
One Puncher - avatar
+ 1
# is an identifier. At one time it probably made a difference for html, but it doesn't seem to anymore
17th Apr 2017, 2:18 AM
LordHill
LordHill - avatar
+ 1
So it really doesn't matter whether you use it or not?
17th Apr 2017, 2:20 AM
One Puncher
One Puncher - avatar
+ 1
Are you getting the color output you desire? Personally I use it, but that's out of habit. makes it easier to skim your code and find it
17th Apr 2017, 2:22 AM
LordHill
LordHill - avatar
+ 1
if your interested, I made a color picker for pc in Java and another for android. I use them for my hex and rgb numbers all the time. it's here on the site I made to throw my projects http://leakyegg.website.tk/
17th Apr 2017, 2:58 AM
LordHill
LordHill - avatar
- 1
<HTML><body><p>title<p></body></HTML>
17th Apr 2017, 4:09 PM
zinou