Home > Web Front-end > CSS Tutorial > How to write the beginning of css file

How to write the beginning of css file

anonymity
Release: 2019-05-28 10:58:16
Original
6373 people have browsed it

If there is no fixed beginning when writing css, just write the select statement.

How to write the beginning of css file

1. Of course, there is also the statement of @charset "utf-8"

This statement tells the browser [my CSS file is UTF-8 encoded], but in fact this file does not need to be UTF-8 encoded, so this statement can deceive the browser.

But practice shows that chrome will have incompatibility bugs, so you can try writing like this:

@charset="UTF-8";
@charset="utf- 8";

2. Conventional approach (default style elimination)

*{margin:0; padding:0}/*Global style: inside and outside The margin is 0*/

li{list-style:none}/*Eliminate the small dot in front of the li tag*/

a{text-decoration:none}/*Eliminate a Tag underline*/

img{border:none}/*Eliminate the border of the picture, ps: because when the picture is wrapped by the a label, a border will be automatically added to the picture, just like the text of a package will be added to the text Same as underlining*/

body{width:100%; max-width:640px; margin:0 auto; overflow:hidden}

This cannot be said to be a standard beginning, but in The experience accumulated when writing styles is to eliminate the default styles that we generally do not use in the page at the beginning of the CSS, so as to prevent us from repeatedly eliminating the styles in subsequent writing, wasting work time and reducing work efficiency.

The above is the detailed content of How to write the beginning of css file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template