当前位置: 首页 > 工具软件 > CSS Usage > 使用案例 >

CSS Basic Syntax and usage

华恩
2023-12-01

Naming rules:

use letters, numbers, slashes, or minus signs. Don’t start with numbers.

CSS Syntax:

/*
    Selectors{
    attribute:value;
    attribute:value;
    attribute:value;
    }
*/

Comment methods in CSS: /*...*/


Inline style (inline style):
Use the style attribute in the HTML tag to set the CSS style.

<a style="color:green;"></a>

Internal Style (inline style)

<head>
    <style type="text/css">
        a{color:green;}
    </style>
</head>

External import mode (external link-in)

Use the <link/> tag in the <head> tag to import an external CSS file to act on the HTML page, thus implementing the CSS style settings.

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

pay attention:

The precedence of three CSS styles:

  • When styles conflict, refer to CSS styles on a proximity basis
  • If there are no style conflicts, refer to the CSS style by superimposing it
 类似资料:

相关阅读

相关文章

相关问答