css code"; 2. Use the link to introduce, the syntax is ""."/> css code"; 2. Use the link to introduce, the syntax is "".">

Home  >  Article  >  Web Front-end  >  How to introduce css in the head area

How to introduce css in the head area

青灯夜游
青灯夜游Original
2021-07-02 16:19:193785browse

Introduction method: 1. Use the style tag to introduce, the syntax "c9ccee2e6ea535a969eb3f532ad9fe89css code531ac245ce3e4fe3d50054a55f265927"; 2. Use the link to introduce, the syntax "8bfad362288f64d2efcd30ae9cd0702b".

How to introduce css in the head area

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

There are two ways to introduce css in the head area:

  • Internal style sheet--defined with style tags

  • External Style sheet - use the link tag to introduce

##1. Internal style sheet - use the style tag to define

Write the css code in HTML In the head tag of the document, and defined with the style tag, its basic syntax format is as follows:

<head>  
<style type="text/css"> 
css代码
</style> 
</head>

In the syntax, the style tag is generally located after the head tag, or it can be placed anywhere in the HTML document .

The general format of css code:

css选择器{ 
  属性:值;
  属性:值;
  .....
}

2. External style sheet--use the link tag to introduce

Put all styles in one or In multiple external style sheet files with CSS extensions, the external styles are linked to the HTML document through the link tag. The basic syntax format is as follows:

<link rel="stylesheet" type="text/css" href="css文件路径" />

  • rel attribute: defines the current The relationship between the document and other linked documents, "stylesheet" means: the linked document is a style sheet file

  • href attribute: defines the URL of the linked external style sheet file, It can be a relative path or an absolute path

(Learning video sharing:

css video tutorial, html video tutorial)

The above is the detailed content of How to introduce css in the head area. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn