Home >Web Front-end >HTML Tutorial >Day 4 of building a website using web standards: calling style sheets
Use web standards to design websites. The transition method is mainly to use XHTML+CSS. CSS style sheets are essential. This requires all web designers to be proficient in CSS. If you have not used it before, start learning now. To create a website that complies with web standards, you cannot design beautiful pages without knowing CSS.
In fact, all aspects of performance need to be implemented with CSS. We used to use tables for positioning and layout, but now we have to use DIV for positioning and layout. This is a change in the way of thinking, which is a bit uncomfortable at first. Haha, there will be resistance to any change. In order to enjoy the "benefits" brought by standards, it is worthwhile to give up some old traditional practices.
Externally calling style sheets
In the past, we usually used style sheets in two ways:
In-page method: writing the style sheet directly in the head area of the page code. Something like this:
External calling method: Write the style sheet in a separate .css file, and then call it with code similar to the following in the head area of the page.
In line with web In the standard design, we use the external calling method. The benefits are self-evident. You can change the style of the page without modifying the page and only modify the .css file. If all pages call the same style sheet file, then changing one style sheet file can change the styles of all files.
Double table method to call style sheet
Looking at the original code of some sites that meet the standards, you may see that there are the following two sentences where the style sheet is called:
Why do you have to write it twice?
In fact, under normal circumstances, it is enough to use the external link method (that is, the first sentence). The double table call I use here is just an example. The "@import" command is used to enter the style sheet. The "@import" command is invalid in Netscape 4.0 browsers. In other words, when you want certain effects to be hidden in the Netscape 4.0 browser and displayed in 4.0 or above or other browsers, you can use the "@import" command method to call the style sheet.
The above is the fourth day of building a website using Web standards: the content of calling the style sheet. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!