How to introduce css in the head area

青灯夜游
Release: 2021-07-02 16:26:04
Original
3692 people have browsed it

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

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>
Copy after login

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选择器{ 
  属性:值;
  属性:值;
  .....
}
Copy after login

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文件路径" />
Copy after login

  • 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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!