Цвета и фоны
Эта страница требует современного браузера (с поддержкой SharedArrayBuffer). Пожалуйста, обновите Chrome, Edge, Firefox или Safari до последней версии.
English
Colours
- You can name a colour:
red,blue,green,tomato,gold, and many more. - Or use a hex code like
#2a7ae2— a#followed by six hex digits (0–9anda–f). - Names are easy to remember; hex codes give you millions of exact colours.
English
Backgrounds
colorchanges the text colour.background-colorchanges the colour behind an element.- Put
background-coloronbodyto colour the whole page.
English
<style>
body { background-color: #f3f4f6; }
h1 { color: tomato; }
</style>
<h1>Hello!</h1>
<p>A page with a soft grey background.</p>
English
Common mistakes
colorsets the text;background-colorsets the background.- A colour is a name, a
#rrggbbcode, orrgb(...).
English
Now you try
coloris the text;background-coloris behind it.- Colour the page background, then use a hex colour on the heading.
Сложность 2/5 · 140 монет + небольшой бонус за первое завершение сегодня
Придайте всей странице мягкий фон. Добавьте body { background-color: lightyellow; }.
Сложность 2/5 · 140 монет + небольшой бонус за первое завершение сегодня
Окрасьте заголовок с помощью шестнадцатеричного кода. Добавьте h1 { color: #2a7ae2; } (это синий цвет).
Сложность 2/5 · 140 монет + небольшой бонус за первое завершение сегодня
Цвета можно смешивать из красного, зелёного и синего. Задайте заголовку цвет rgb(0, 128, 0), а фону страницы — #f0f8ff.