Embedding methods and layout advantages of div css_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:31:02
Original
1299 people have browsed it

Advantages of div css embedding and layout

1. Embedding method

Inline application

You can declare the style directly in the HTML file.

For example, Thisisfontsize16. The above HTML file will appear on the browser as: Thisisfontsize16. Embedded application styles can be embedded in HTML files (usually in the ). For example, the background color is red< /body> The above HTML will appear: the background color is red

External link application

In this way, all CSS style declarations are stored in another file. The file is usually named .css. In the

..
of the HTML document, we will use the following code to link the .css file:

 

The above line will add the styles declared in the external-stylesheet.css file to the HTML file.

Import Application

External CSS styles can also be imported into HTML files. The way to import is to use the @import command.

The syntax of @import is:

The original purpose of the @import directive was to use different styles for different browsers. However, this is no longer necessary. The most common purpose of using @import today is to add multiple CSS styles. When multiple CSS styles are added via @import and different CSS styles conflict with each other, the CSS styles added later have priority (see CSS concatenation for details).

There is also a way to embed directly on the tag, but this writing method has some limitations. Most tags can accept this solution:

 

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template