If there is no fixed beginning when writing css, just write the select statement.
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!

CSS Grid is a powerful tool for creating complex, responsive web layouts. It simplifies design, improves accessibility, and offers more control than older methods.

Article discusses CSS Flexbox, a layout method for efficient alignment and distribution of space in responsive designs. It explains Flexbox usage, compares it with CSS Grid, and details browser support.

The article discusses techniques for creating responsive websites using CSS, including viewport meta tags, flexible grids, fluid media, media queries, and relative units. It also covers using CSS Grid and Flexbox together and recommends CSS framework

The article discusses the CSS box-sizing property, which controls how element dimensions are calculated. It explains values like content-box, border-box, and padding-box, and their impact on layout design and form alignment.

Article discusses creating animations using CSS, key properties, and combining with JavaScript. Main issue is browser compatibility.

Article discusses using CSS for 3D transformations, key properties, browser compatibility, and performance considerations for web projects.(Character count: 159)

The article discusses using CSS gradients (linear, radial, repeating) to enhance website visuals, adding depth, focus, and modern aesthetics.

Article discusses pseudo-elements in CSS, their use in enhancing HTML styling, and differences from pseudo-classes. Provides practical examples.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
