[Front-end study notes day17] 3.1. Css basic grammar and basic grammar page references + css + css page introduction method

3.1. Css basic grammar and page references

Here Insert Picture Description

The basic syntax of css and page references

The basic syntax of css

css definition is:

Selector {attribute: value; attribute: value; attribute: value;}

The selector is the name of the element associated with the page up and style, the style property is desirable attribute for each attribute there is provided one or more values. Code Example:

/*
    css注释 ctrl+shift+"/"
*/


div{ 
    width:100px; 
    height:100px; 
    color:red 
}

css page introduction method:

1, outreach formula: The link tag linked to the external style sheet to the page.

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

2, embedded: by style tags, create an embedded style sheet on the page.

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

3, inline: The style attribute tag, the direct write pattern on the label.

<div style="width:100px; height:100px; color:red ">......</div>
Published 289 original articles · won praise 94 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_35456045/article/details/104115625