Tematy: kolor | kolor tła | grafika jako tło | powtarzanie tła | zaczepienie tła | pozycja tła | mieszane atrybuty tła
Dane w pigułce | |
Zastosowanie | określa kolor tła elementu |
Dziedziczenie | nie |
Wartości | wartość koloru |
Wartość domyślna | transparent |
Przykład | background-color: olive |
Uwagi | |
Odpowiednik w HTML | bgcolor - przestarzały |
Aby zdefiniować kolor tła, należy wpisać w definicji stylu background-color : wartość
Uwaga: tabelę kolorów znajdziesz tutaj
Wiele elementów może mieć przypisany kolor tła. Przykłady (IE i NN wyświetlają je nieco odmiennie):
<h2 style="background-color: yellow">Tytuł stopnia drugiego na żółtym tle</h2>
Tytuł stopnia drugiego na żółtym tle
<p style="background-color: blue">Akapit na tle Aqua</p>
Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua. Akapit na tle Aqua.
<tr>
<td style="background-color: #808000">Komórka tabeli z zielonym tłem</td>
</tr>
</table>
Komórka tabeli z zielonym tłem |
Specyfikacja CSS2 wprowadza 28 kolorów systemowych (pochodzących z systemu operacyjnego), które integrują się z kolorami środowiska użytkownika. Ich rolę widać np. wyraĄnie po zmianie schematu odpowiedzialnego za wyświetlanie środowiska Windows. Niniejszy akapit jest wyświetlany przy użyciu stylu <p style="color:background">, a więc za pomocą koloru pulpitu Windows. Każdy czytelnik widzi więc ten kolor, który ma na swoim własnym pulpicie.
Są to następujące kolory (według specyfikacji CSS2):
- ActiveBorder - Active window border.
- ActiveCaption - Active window caption.
- AppWorkspace - Background color of multiple document interface.
- Background - Desktop background.
- ButtonFace - Face color for three-dimensional display elements.
- ButtonHighlight - Dark shadow for three-dimensional display elements (for edges facing away from the light source). Shadow color for three-dimensional display elements.
- ButtonShadow - Shadow color for three-dimensional display elements.
- ButtonText - Text on push buttons.
- CaptionText - Text in caption, size box, and scroll bar arrow box.
- GrayText - Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.
- Highlight - Item(s) selected in a control.
- HighlightText - Text of item(s) selected in a control.
- InactiveBorder - Inactive window border.
- InactiveCaption - Inactive window caption.
- InactiveCaptionText - Color of text in an inactive caption.
- InfoBackground - Background color for tooltip controls.
- InfoText - Text color for tooltip controls.
- Menu - Menu background.
- MenuText - Text in menus.
- Scrollbar - Scroll bar gray area.
- ThreeDDarkShadow - Dark shadow for three-dimensional display elements.
- ThreeDFace - Face color for three-dimensional display elements.
- ThreeDHighlight - Highlight color for three-dimensional display elements.
- ThreeDLightShadow - Light color for three-dimensional display elements (for edges facing the light source).
- ThreeDShadow - Dark shadow for three-dimensional display elements.
- Window - Window background.
- WindowFrame - Window frame.
- WindowText - Text in windows.
Interpretacja: Internet Explorer, Firefox, Opera, Chrome