What is a css file generally called?

青灯夜游
Release: 2023-01-03 09:24:29
Original
7523 people have browsed it

css files are generally called CSS external style sheets, with the extension ".css". When you copy the CSS style code into a text file and save it as a ".css" file, it is an external style sheet. CSS files can be referenced in HTML through the "@import" keyword or the "" tag.

What is a css file generally called?

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

css files are generally called CSS external style sheets, with the extension ".css".

CSS External Style Sheet

If the CSS style is placed in a file outside the web document, it is called an external style sheet , a CSS style sheet document represents an external style sheet.

In fact, the external style sheet is a text file with the extension .css. When you copy the CSS style code into a text file and save it as a .css file, it is an external style sheet.

External style sheets must be imported into web documents before they can be recognized and parsed by the browser. External style sheet files can be imported into HTML documents in two ways.

1. Use the tag to import

Use the tag to import the external style sheet file:

<link href="001.css" rel="stylesheet" type="text/css" />
Copy after login

For each attribute Description: The

  • href attribute sets the address of the external style sheet file, which can be a relative address or an absolute address.

  • The rel attribute defines the associated document, which here indicates that the associated document is a style sheet.

  • The type attribute defines the type of imported file. Like the style element, text/css indicates a CSS text file.

Generally when defining the tag, three basic attributes should be defined, among which href is a must-set attribute.

You can also add the title attribute in the link element to set the title of the optional style sheet. That is, when a web document imports multiple style sheets, you can select the style sheet file to be applied through the title attribute value. [Recommended tutorials: CSS Video Tutorial, "html Video Tutorial"]

Tip: In the Firefox browser, you can select "View- -> Page Style" option, and then the title attribute value will be displayed in the submenu. Just select different title attribute values ​​to selectively apply the required style sheet file. IE browser does not support this feature.

2. Use the @import keyword to import

Use the @import keyword in the