Learn CSS #20

CSS Text


CSS has a lot of properties for formatting text.


TEXT FORMATTING

This text is styled with some of the text formatting properties. The heading uses the text-align, text-transform, and color properties. The paragraph is indented, aligned, and the space between characters is specified.


Text Color

The color property is used to set the color of the text. The color is specified by:

  • a color name – like “red”
  • a HEX value – like “#ff0000”
  • an RGB value – like “rgb(255,0,0)”

The default text color for a page is defined in the body selector.

Example

body {
  color: blue;
}

h1 {
  color: green;
}

Text Color and Background Color

In this example, we define both the background-color property and the color property:

Example

body {
  background-color: lightgrey;
  color: blue;
}

h1 {
  background-color: black;
  color: white;
}

div {
  background-color: blue;
  color: white;
}

Important: High contrast is very important for people with vision problems. So, always ensure that the contrast between the text color and the background color (or background image) is good!

35 thoughts on “Learn CSS #20

  1. Hello bro!More info…
    сеть пансионатов
    https://pansionat-rnd.ru/
    “Дом престарелых” – это общепринятое название для социального учреждения, которое оказывает услуги по социальной защите и помощи престарелым людям. Если вы ищете информацию о конкретном доме престарелых в Ростове-на-Дону, можете уточнить местоположение и другую информацию.
    частный пансионат

    http://images.google.com.pe/url?q=https://pansionat-rnd.ru/ https://images.google.at/url?q=https://pansionat-rnd.ru/ http://images.google.de/url?q=https://pansionat-rnd.ru/ https://cse.google.vg/url?q=https://pansionat-rnd.ru/ http://cse.google.td/url?q=https://pansionat-rnd.ru/

Leave a Reply

Your email address will not be published. Required fields are marked *