Home  >  Article  >  Web Front-end  >  What is the css calling method?

What is the css calling method?

青灯夜游
青灯夜游Original
2021-10-12 15:26:046504browse

css calling method: 1. The css internal style defined by style in the head part of the document needs to be called using the css selector name in the tag of the web page; 2. The css style written in the external file must be used in the HTML web page Called through the link tag.

What is the css calling method?

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

Different methods of using css in HTML web pages have different methods of calling css.

1. Internal style sheet calling method:

When a single file requires special styles, you can use the internal style sheet. You can define internal style sheets via the c9ccee2e6ea535a969eb3f532ad9fe89 tag in the head section.

<head>
<style type="text/css">
body {background-color: red}
p {margin-left: 20px}
</style>
</head>

The internal style sheet is a css style sheet written in the HTML web page using the c9ccee2e6ea535a969eb3f532ad9fe89 tag. We can call it using the css selector name in the tag of the web page.

2. External style sheet calling method:

When styles need to be applied to many pages, external style sheets will be the ideal choice. Using external style sheets, you can change the look of your entire site by changing one file.

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

External style sheets are css styles written in external files and called through the link tag in HTML web pages.

Note:

In addition to external style sheets and internal style sheets, there is also an inline style in the types of css styles.

But because the inline style is written directly in the HTML tag, there is no need to call it.

(Learning video sharing: css video tutorial)

The above is the detailed content of What is the css calling method?. 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
Previous article:How to clear float in cssNext article:How to clear float in css