This page has been robot translated, sorry for typos if any. Original content here.

Text formatting

Text formatting

When filling out Web pages with text formatting in html, one has to deal more than with other elements and if not for styles , this occupation was long and monotonous. Cascading style sheets with their latest CSS 2.0 specification can set the text any formatting options. Although there are many textbooks on this topic, one can more simply approach this topic. So...

So using the family property of the HTML language, you can specify the typeface. The values ​​put the name of the font or better list them in order of priority. You can apply font classifications in values: serif (with serifs), sans-serif (sans serif), monospase (monospaced), cursive (oblique), fantasy (arbitrary).

Font-size - sets the font size in html. In the values ​​you can specify both numerical values ​​in units of measurement, and use the keywords:

  • Medium - the default font size is set to its value.
  • small - 20% less than medium ;
  • x-small - 20% less than small ;
  • xx-small - 20% less than x-small ;
  • large - 20% more than medium ;
  • x-large - 20% more than large ;
  • xx-large - 20% more than x-large .

According to the style, the font will change in HTML using the font-style property and its values: normal ( default ), italic ( italic ), oblique ( oblique ). The thickness of the font adjusts the font-weight property with the values normal ( default ) and bold ( bold ). The height of lowercase letters is formed by - font-size-adjust , and if small-casp is set, the font will be in uppercase in another font-variant property, and the size will be lowercase.

The spacing between characters is determined by the letter-spacing property , which is measured in (em) . The interval between words shows - word-spacing . With the help of text-transform, the case is changed by means of the values: capitalize (the first letters of all words will be capitalized), lowercase (gives the characters a lowercase view), uppercase (forms uppercase characters).

When aligning text on a page, using html and css, the text property is used - align with the values left (left), right (right), center (center), justufy (page width). Vertical text alignment can occur only in a table with vertical- align with the values top (along the top), bottom (along the bottom), middle (along the middle).

When specifying the distance between the lines, you will need to use the line-height property , whose values ​​can be measured in any of the available units, as well as in percentages. When assigning indentation to the beginning of a paragraph, text-indent is already used, with the same values.

The spaces are formatted with the participation of the white-space property and its three values: normal (characters of several spaces are converted to one), pre (they will not be converted to one), nowrap (the text will be transferred by special tags).

Text-decoration creates additional attributes to the text in the form of underline ( underline ), strikethrough ( line-through ) and overline ( overline ).

With CSS, you can format lists , regardless of their variations. In the values ​​of the list-style-type property, you can specify the following:

  • disk, circle, square - a marker in the form of a filled circle, a circle and a filled square, respectively, for one or another list.
  • lower-roman and upper-roman - numeration of the list with roman numerals in small and large sizes respectively for the list in use.
  • lower-alpha and upper-alpha - numbering in lowercase and uppercase Latin letters.
  • decimal - numbering of the list, by CSS, in Arabic numerals.
  • none - no numbering and bullets for lists.

The list-style -image property allows a small image to be used as a marker. To do this, you need to specify its address and name. Example: list-style-image: url ( address / file name )

The distance from the edges is controlled by the list-style-position property by means of inside (increase) and outside (decrease) values.

If you have sufficiently learned all the details of the text formatting textbook, then run any HTML editor on your computer. Find there CSS and start from school to practice.