#FF0000
can be shortened to #F00
. This shortened form gives one digit for red, one digit for green, and one digit for blue.
This reduces the total number of possible colors to around 4,000. But browsers will interpret #FF0000
and #F00
as exactly the same color.
Color | Short Hex Code |
---|---|
Cyan | #0FF |
Green | #0F0 |
Red | #F00 |
Fuchsia | #F0F |
h1
element with the text I am red!
the color
red.
testString: assert($('.red-text').css('color') === 'rgb(255, 0, 0)', 'Give your h1
element with the text I am red!
the color
red.');
- text: Use the abbreviate hex code
for the color red instead of the hex code #FF0000
.
testString: assert(code.match(/\.red-text\s*?{\s*?color:\s*?#F00\s*?;\s*?}/gi), 'Use the abbreviate hex code
for the color red instead of the hex code #FF0000
.');
- text: Give your h1
element with the text I am green!
the color
green.
testString: assert($('.green-text').css('color') === 'rgb(0, 255, 0)', 'Give your h1
element with the text I am green!
the color
green.');
- text: Use the abbreviated hex code
for the color green instead of the hex code #00FF00
.
testString: assert(code.match(/\.green-text\s*?{\s*?color:\s*?#0F0\s*?;\s*?}/gi), 'Use the abbreviated hex code
for the color green instead of the hex code #00FF00
.');
- text: Give your h1
element with the text I am cyan!
the color
cyan.
testString: assert($('.cyan-text').css('color') === 'rgb(0, 255, 255)', 'Give your h1
element with the text I am cyan!
the color
cyan.');
- text: Use the abbreviated hex code
for the color cyan instead of the hex code #00FFFF
.
testString: assert(code.match(/\.cyan-text\s*?{\s*?color:\s*?#0FF\s*?;\s*?}/gi), 'Use the abbreviated hex code
for the color cyan instead of the hex code #00FFFF
.');
- text: Give your h1
element with the text I am fuchsia!
the color
fuchsia.
testString: assert($('.fuchsia-text').css('color') === 'rgb(255, 0, 255)', 'Give your h1
element with the text I am fuchsia!
the color
fuchsia.');
- text: Use the abbreviated hex code
for the color fuchsia instead of the hex code #FF00FF
.
testString: assert(code.match(/\.fuchsia-text\s*?{\s*?color:\s*?#F0F\s*?;\s*?}/gi), 'Use the abbreviated hex code
for the color fuchsia instead of the hex code #FF00FF
.');
```