CSS (Cascading Style Sheets)

CSS (Cascading Style Sheets) are a popular tool in web design. It is hard to imagine many web applications without them. They can speed up the creation and editing of web pages. A CSS file is practically written as a kind of text file and contains instructions for the design. Thus, it is also possible for all subpages of a homepage to use the same design by calling this CSS file in the header of the respective page. If you change the design, you only need to change the CSS file and it will affect all pages of the web project to be edited.

Formatting options

With the special programming language CSS almost all formatting tasks of a website can be done, at least those concerning the design. With CSS you can even create frames of different shades and simple graphics. Fonts and font sizes are defined once in the CSS file and are thus automatically available in the entire catalogue or company presentation. There are many possible variations, because certain areas such as headings, table contents, captions or footnotes can all be defined separately. Different coloured backgrounds with or without patterns can be declared via CSS. Different bullet points, various dynamic elements and much more can be realized with CSS. Images, videos and audio sequences can also be integrated this way, if you don't want to do it in any other way.

Syntax

According to the W3C guidelines, the properties to be displayed are subject to certain sets of rules. There are selectors that assign a certain value to the respective property in curly brackets. For example, in the case of the color of a second-order heading, this can look like this: h2 { color: green; } Instead of "green" there could also be a color number. Here, "h2" would be the selector, "color" the property and "green" the assigned value. Of course several properties can be assigned at once. Important are the spaces after the opening and before the closing parenthesis and the semicolons at the end of each assignment. For the sake of clarity, it is recommended to arrange each property in an extra line. For extensive projects, the website then not visible internal comments make sense.

cssFields of application and special features

Cascading Style Sheets are relatively easy to integrate into HTML and PHP projects. HTML (Hyper Text Markup Language) was initially the most widespread area of application. Single style sheets can be inserted here also within a HTML file with the style commands. Cascading style sheets, i.e. several design elements, are defined in a separate file and either called up in a specific area of an HTML file or, more favourably, in the header as an external file. In PHP (Hypertext Preprocessor - actually Personal Home Page Tools) the CSS are not only included as *.css file, but linked with PHP commands. A combination of PHP and HTML is also possible in principle. The more modern variant is to work with databases, in which in the case of MySQL for example, the properties of the web project can be created via PHP and CSS. Numerous database systems use similar techniques. However, most of them use additional programming languages that also use CSS. Unfortunately there are some special features regarding operating systems and browsers to consider. Not all effects look the same in every browser, some are even not interpreted by all. Therefore different versions often have to be considered depending on browser and operating system in the way the values are assigned to the properties in the CSS. For this purpose, the operating system and browser used are usually queried from the header of the HTML or PHP file or from the database system and a correct CSS version is assigned.

assets and drawbacks

CSS are a welcome addition and simplification to HTML and PHP projects. They are logically structured and can be learned relatively quickly. An error in a CSS file, however, will show up on several pages at once, but can also be fixed quickly. There are problems with exotic fonts and foreign language sets. Therefore you should take precautions and specify an alternative variant. In the case of a special font, a value for a font that is normally present everywhere could be assigned in front of it. CSS to use the last named value for a property. If this value cannot be displayed, it is ignored. If you have assigned the simple font before this assignment, it is considered the last interpretable font and your page will still be displayed in a usable way. Foreign language sets and other special features must be integrated into the web project via HTML, PHP or another programming language or, if necessary, redirected to an English page.

Current articles