[Preliminary web] Introduce CSS style sheets

Inline (inline style)

Set the style of the element through the style attribute of the tag

<标签名 style="属性1:属性值1; 属性2:属性值2; 属性3:属性值3;"> 内容 </标签名>

Internal style sheet (inline style sheet)

The CSS code is written in the head tag of the HTML document and is defined by the style tag

<head>
<style>
	 div {
	 	color: red;
	 	font-size: 12px;
	 }
</style>
</head>

External style sheet (external chain)

Put all the styles in one or more external style sheet files with the extension of .CSS **, and link the external style sheet files to the HTML document through the link tag

<head>
  <link rel="stylesheet" type="text/css" href="css文件路径">
</head>
Attributes effect
rel Define the relationship between the current document and the linked document, which needs to be specified as "stylesheet" here, indicating that the linked document is a style sheet file.
type Define the type of the linked document, which needs to be specified as "text / CSS" here, indicating that the linked external file is a CSS style sheet. We can all omit
href Define the URL of the linked external style sheet file, which can be a relative path or an absolute path.
163 original articles published · Like 18 · Visitor 7684

Guess you like

Origin blog.csdn.net/xcdq_aaa/article/details/105365962