While the use of CSS is now considered a “best practice” for websites, the idea of style sheets has been around for a long time. Programs such as Microsoft Word, Adobe PageMaker, and other desktop publishing programs allow users to create styles to adopt a uniform format across a document or an entire document group. The main idea is to group formatting features (such as font size, color, and bolts) in a style and give the style a name. Then you can use the style over and over again. This will save you time to remember the previously formatted text.
Even for the web, document how CSS works a few years before the browser catches up. Web developers have not used CSS for years because they cannot rely on the browser to figure out the code and render the web page correctly. On the contrary, it is easier for web developers to use inappropriate HTML tags for their visual design. For example, HTML has a blockquote tag, which should highlight the direct quotes area of the page. The blockquote tags are indented half an inch; that’s why web designers decided they would (misuse) quotes when they wanted to poke half an inch.
The problem is that HTML is not intended as a resource for artists. It is designed as a way of displaying the content structure (titles, subtitles, etc.) – not as a visual design structure! One result of using HTML is that there is a lot of formatting code on every web page, as designers have become very creative in making HTML work on demand. Anytime you want to change the format of the above text, you will need a new set of format codes.
What is CSS?
CSS can have many meanings depending on how you use it. CSS is not only a kind of code, but also the principle of using the code. Compared to HTML formatting, CSS offers more formatting options and finer adjustments. For example, you can now use an unlimited number of size and unit combinations instead of being limited to 7 font sizes.
On the other hand, CSS can also make you study longer. In fact, due to CSS’s learning curve, some developers are simply reverting to the table. Other designers are also eager to create messy CSS code to convert from tables to CSS. These are not necessary!
As mentioned above, an important principle of CSS is that content structure and visual structure are treated as two separate concepts. This idea can be confusing because most people put something on the page during the development process, highlight it and add formatting, and then move on to the next part of the page. With CSS, you can identify an area in an HTML file as the title of a web page, and then control the appearance of the title in a separate file (style sheet). You can then use these styles on the whole page or part of the page. If you don’t like the style just change the style sheet and all the pages will change.
When using CS, the person posting the content on the HTML page and the person creating the style sheet don’t even have to be the same. CSSZenGarden is a website project that took this idea, created the content and then had others build the style. They played a game to see what different styles people would come up with! Another important principle behind CSS is that the format of the website must be uniform. The same goes for your printed documents. From page to page, visual continuity makes people feel more comfortable with your website.
To learn CSS, you must master two basic concepts: 1) how CSS code works; 2) how CSS is used on HTML pages.
A brief look at CSS coding
The principle of CSS is not only different from HTML, but also the coding of CSS is completely different from HTML. The code shows the name of the style and how it should be formatted when used on a web page. For example, the following style is called BodyText
. central part
font size: 12px;
Row height: 24px;
Text alignment: alignment;
Letter weight: 400;
Note that this looks very different from HTML. All sizes are enclosed in braces. Each attribute has a name, a colon, a value, and a semicolon. Many designers are starting to use CSS by formatting text with CSS. Using CSS to place elements on a web page is much more difficult, but starting with text format is a good way to start!