As the popularity of the Web has grown in the nineties, the intention also grew to apply a certain design to the site. Web developers relied on specific HTML tags to improve web pages:
determined the font of the entire HTML document; - determined the headset, color and size of the text, which is inside;
Aligned all its contents in the center; - Increased text size;
Displayed the text crossed.
Multiple HTML attributes could also be used:
- bgColor defined the background color of the element;
- text Detected text color;
- mARGIN attributes could be used to add space from either side of the element.
Why avoid tables?
But first of all, to create columns, visual alignment of elements and, in general, positioning elements relative to each other, web developers used an element
Logo | Tagline | |
---|---|---|
Copyright 2015. | ||
Left menu | Main content | Right Sidebar |
Such an approach was bulky for several reasons:
- tables in HTML. various: They require a lot of template code;
- marking was semantically incorrect: Tables should be used for multidimensional data;
- changing the layout required a change in markup: if we wanted to move the left column to the right, they should have been modify HTML structure;
- tables were prone to syntax errors: lines and cells for correctness must go and invest in a certain way;
- marking was unreadable: Tables were invested in other tables to get additional columns inside the columns.
That is why from the application of tables as a tool slowly refused and instead of them used CSS.
What is CSS
CSS (Cascading Style Sheets) means cascading style sheets and is a style markup language (as HTML or XML). Thus, CSS does not represent anything in itself, if not related to an HTML document.
CSS brought a life In an HTML document, choosing fonts, applying colors, defining indents, positioning elements, animating interactions and much more.
How CSS works
CSS. chooses HTML element (for example, paragraph), asks property To change (such as color) and applies a certain value (for example, red):
P (Color: Red;)
The word "style" can be deceptive. You might think CSS is used only to change the color of the text, size and type of font. But CSS can set the layout of an HTML document, determining the height, width, internal and external fields, position, column, etc.
Where can I write CSS?
CSS as an attribute
You can write CSS directly in HTML elements using the STYLE attribute:
This is an important text.
CSS B.
You can use the tag
This paragraph will be red.