what is css
CSS (cascading style sheet, can be translated as "cascading style sheet"), is a set of formatting rules used to control the appearance of web pages
how to style a label
Step 1: It must be ensured that the introduction method is correct
Step 2: You must associate css and html elements, that is to say, you must first find this element
Step 3: Modify the style of the html element with the corresponding css attribute
Three import forms of css
1. Embed css into the HTML file, which is also called inline style sheet, for example
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>First page</title> <style type="text/css"> #box{ width: 100px; height: 100px; background: red; } </style> </head> <body> <div id="box"></div> </body> </html>
2. Linking an external style to the HTML file is also called linking style sheets, for example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>First page</title> <link rel="stylesheet" href="css/index.css" /> </head> <body> <div id="box"></div> </body> </html>
3. Add the style sheet to the HTML file, this method is also called inline style sheet
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>First page</title> </head> <body> <div style="width: 200px;height: 200px;background: green;"></div> </body> </html>