How to load css file
How to load css files: 1. Use the "" statement to load; 2. Use "@ import url("css file path");" statement is loaded.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
Method 1: Loading through the link tag
The tag defines the relationship between the document and external resources. The most common use of the tag is link style. surface.
Use the tag in the
tag pair of the web page to call the external CSS file.Grammar format:
<link rel="stylesheet" type="text/css" href="css文件路径" />
Description of each attribute:
href attribute sets the address of the external style sheet file, which can be a relative address or Can be 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.
Note:
This method will load the CSS file before loading the main body of the web page file, so the displayed web page will have a style effect from the beginning. Unlike the import method, the unstyled web page will be displayed first and then the styled web page will be displayed.
Method 2: Loading via @import
@import rules are used to import style rules from other style sheets. These rules must precede all other types of rules. .
Use the @import command to import external style sheet information into the page. It exists in the tags.
<style type="text/css"> @import url("css文件路径"); </style>
Note:
Using @import to introduce CSS can easily introduce CSS code from external files, making maintenance and planning easier. However, every time an additional CSS file is introduced, a connection request will be added to the server. When the number of visits is large, a trade-off needs to be made between maintainability and performance.
Using the @import method to load will cause the CSS file to be loaded only after the HTML page is loaded. That is to say, before the CSS file is loaded, the page will run naked, but the response speed will be faster when entering the website. !
(Learning video sharing: css video tutorial)
The above is the detailed content of How to load css file. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-
