Зміст курсу
Основи CSS
Основи CSS
Кольори Тексту
Застосування кольору тексту
Колір тексту можна додати до текстового елемента за допомогою CSS-властивості color
, надавши їй значення будь-якого кольору. Сучасні браузери підтримують три варіанти значень кольору: RGB, hex і імена кольорів. Розглянемо наступний приклад. Ми застосуємо до тексту червоний колір.
Примітка
Ми можемо знайти кілька цікавих кольорових шаблонів за адресою colorhunt.co.
index.html
index.css
Note
We can find some exciting color templates at colorhunt.co.
Способи задання кольору
Існує три основні способи: назва кольору, hex, rgb.
Назва кольору
Ми можемо використовувати зарезервовані слова кольору. Список зарезервованих кольорів можна знайти за адресою htmlcolorcodes.com
Color name
We can use reserved color words. The list of reserved colors can be found at htmlcolorcodes.com
Ways to specify color
There are three main ways: color name, hex, rgb.
Color name
We can use reserved color words. The list of reserved colors can be found at htmlcolorcodes.com
Hex format
Hex represents colors as a six-digit code consisting of three pairs of two-digit values. Each pair represents the intensity of red, green, and blue (in that order).
Hex format values range from 00
(no intensity) to FF
(maximum intensity).
RGB Format
RGB represents colors as a series of three numbers that correspond to the intensity of red, green, and blue (in that order)
RGB format values range from 0
(no intensity) to 255
(maximum intensity).
Transparency
Transparency in rgb colors can be achieved by using the rgba
notation (red, green, blue, alpha), where alpha is the level of opacity or transparency of the color.
The alpha value can range from 0
(completely transparent) to 1
(completely opaque). For example, the RGBA value rgba(0, 255, 0, 0.5)
represents a green color with 50% opacity.
index.html
index.css
Дякуємо за ваш відгук!