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

CSS technology (cascading style sheets)

Cascading style sheets (hereinafter simply referred to as styles ) are designed to facilitate the work of Web-masters. For example, when creating a website from multiple pages, you want the page elements to be formatted according to a specific template, which would not force you to enter long attribute values ​​into the code of each page. Styles are such a template. The general principle of writing them comes down to the following sequence:

style1: value; style_st property2: value; ....... style_styleN: value,

where the remaining punctuation marks are applied depending on the style properties.

By their properties, styles are divided into three groups.

  1. They are used when you need to format an element that does not repeat anywhere else on the page and is relevant to a specific tag. This style is described as follows: <TEG attribute1 = "value" ...... attributeN = "value" STYLE = "style_style1: value ... style_styleN: value">
  2. Used to describe how to format page elements globally with a name assigned to each style. This description is placed directly into the page code - into the <HEAD> container with the help of the <STYLE> container. Here is an example: <HEAD> <STYLE type = text / css > .name_style { description_style } TD . style_name { style_ description } </ STYLE> </ HEAD> , where "type = text / css" is mandatory information, and TD is the tag designation to which the style will be applied. Under the words " description_style " should understand the various formatting options for the element, which can be many.
  3. Used when applying styles in large quantities or when there are more than ten pages, representing a separate text file with the extension .css . The link to such a file is specified in the <HEAD> container and looks like this: <LINK HREF = " stylefile_address / filename.css " TYPE = "text / css" REL = "stylesheet">, where TYPE and REL are attributes that define the type the file. By the way, it is possible to refer in another way: @import url (" stylesheet_address / filename_ .css").

After specifying styles in the page itself or making a link to them - you can apply them with the direct participation of the attributes <CLASS> or <ID> on the necessary tags. Example :

<TD CLASS = " style_name "> page element </ TD> .

There are also two more ways to apply styles - the description of pseudo-classes and pseudo-elements.

Units of measurement in CSS are denoted in:

  • pixels (px) - the minimum point on the screen
  • paragraphs (pt) - font unit of measure (1 point = 1/72 inch
  • peaks (pc) - 1 peak is 12 points
  • percent (%) - relation to another value
  • millimeters (mm) and centimeters (cm) - no comments
  • inches (in) - 1 inch equals 2.52 cm

In styles, as in all HTML, the RGB model is used to describe colors.

In the HTML 4.01 specification of this language, cascading style sheets should be used everywhere , where they can be applied. The W3C International Consortium , which endorses this specification, recommends using CSS (Cascading Style Sheets). Other methods are marked as undesirable.

Built-in tools for creating cascading style sheets of many HTML editors allow you to very quickly and conveniently cope with this task. However, not having sufficient knowledge in this direction - the result will be the opposite.

Among the wide selection of HTML editors in which there is the possibility of creating cascading style sheets it is worth highlighting in our opinion simple and clear - Macromedia HomeSite 5.0 with its Top Style and Macromedia Dreamweaver MX 2004. The latter will be better for beginners.

Before proceeding to the editors, we strongly recommend that you go through theoretical lessons on those links.