CSS basic syntax and page reference


The definition method of css basic grammar css is:

selector { attribute:value; attribute:value; attribute:value;}

A selector is a name that associates a style with a page element, and an attribute is the style attribute you want to set. Each attribute has one or more values. Code example:

div{ width: 100px; height: 100px; color: red }
CSS page introduction method:
1. External type: link to the external style sheet to the page through the link tag.

<link rel="stylesheet" type="text/css" href="css/main.css">

2. Embedded: Create an embedded style sheet on the web page through the style tag.

<style type="text/css">
    div{ width:100px; height:100px; color:red }
    ......
</style>

3. Inline: Write the style directly on the label through the style attribute of the label.

<div style="width:100px; height:100px; color:red ">......</div>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325496969&siteId=291194637