Get the App
SLTechnology News&Howtos  ›  Development  › 

Introduction to the method of putting CSS into web pages

Shulou Source: shulou.com Published: 2022-06-03 17:53:37 10月06日 Update

This article introduces the relevant knowledge of "introduction to the method of putting CSS into the web page". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Several ways to put CSS into web pages

In-line application

◆ We can declare styles directly in the HTML file.

For example, Thisisfontsize16.

The above HTML file will appear in the browser as: Thisisfontsize16.

◆ embedding styles can be embedded in HTML files (usually inside).

For example

Div {div {background-color:#FF0000;} background color is red

The above HTML will show that the background color is red

External connections are applied in this way, and all CSS style declarations are stored in another file. The file is usually named .css.

In the HTML file.. We will link this .css file with the following code:

The above line adds the style declared in the external-stylesheet.css file to the HTML file.

Import and apply

Import external CSS styles can also be imported into HTML files.

The import is done by using the @ import directive.

The syntax for @ import is

Tags: Style label file layout file web page different content place way method obvious for example multiple case instruction more column browser knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple macOS MariaDB Microsoft