Get the App
SLTechnology News&Howtos  ›  Development  › 

How to define and use the three styles of CSS

Shulou Source: shulou.com Published: 2022-06-01 06:12:25 09月28日 Update

This article introduces the relevant knowledge of "how to define and use the three styles of CSS". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

CSS styles are divided into: inline CSS style, embedded CSS style, external CSS style

inline css style

Inline CSS stylesheets are css code written directly into existing HTML tags:

This is a paragraph marker.

Take the style attribute. Scope applies only to this label.

This method is flexible, but it is troublesome to define the same style for multiple identical labels, which is suitable for local modification.

embedded CSS style

in HTML documents.

< head >

used in

< style >

The tag,, is called embedded.

/* Selector {Attribute: Attribute Value; Attribute: Attribute Value;}*/a{color:#FF0000 ;}#img1{width:800px;} /*id selector */.img2{ width:800px;} /* class selector */hyperlink

Add the head tag

< style >

Tags, uniform modification of multiple tags, range for this page. Novice note: if you encounter problems in learning can not find someone to answer, you can point me into the skirt, inside the big guy answer and web front-end intensive teaching. Cheng!

This method can set the style of a single page uniformly, but it is not flexible enough for local.

External CSS style

using

< link >

Labels. For example:

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

< /link >

A. The CSS code is as follows

/* Selector {Attribute: Attribute Value; Attribute: Attribute Value;}*/a{color:#FF0000 ;}#img1{width:800px;} /*id selector */.img2{ width:800px;} /* class selector */

Introduction of CSS in HTML

hyperlink

External CSS style (also known as external style) is to write CSS code in a separate external file, this CSS style file with the extension ".css"(can also be used to call other website CSS).

"CSS three styles how to define the use of" the content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Tags: Style attribute tag selection code content multiple that is partial embedded file way more tag knowledge website scope link page learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Huawei Shulou Tech Info MariaDB Shulou Information