Home > Web Front-end > CSS Tutorial > What are the styles of css?

What are the styles of css?

醉折花枝作酒筹
Release: 2023-01-06 11:16:00
Original
19068 people have browsed it

There are three types of css styles, namely: 1. Inline CSS style, syntax ""; 2. Inline CSS style , the syntax ""; 3. External CSS style, use the link tag to introduce css.

What are the styles of css?

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

CSS (full name: Cascading Style Sheets, Cascading Style Sheets) is a computer used to express file styles such as HTML (an application of Standard Generalized Markup Language) or XML (a subset of Standard Generalized Markup Language). language.

CSS is a cascading style sheet, a programming language used to represent HTML styles. The latest version of CSS is css3. CSS is a style language that can separate web pages and content.

CSS can not only statically modify web pages, but also dynamically format various elements of web pages in conjunction with various scripting languages.

Before CSS entered the front-end language, many people regarded CSS as a front-end language. Today, CSS can not only decorate web pages, but also format web pages with various scripts.

CSS styles mainly include the following three types:

1. Inline style (embedded style): inside the structure, that is, the style written within the tag; written inside the beginning part of the tag , among the style attributes.

<标记 style="样式的属性名1:样式的属性值1;属性名2:属性值2;......"></标记>
Copy after login

Example:

<div style="color:red"></div>
Copy after login

2. Internal style (inline style): written inside the HTML page, stored in the head tag, and the style is written in the style tag.

<style>选择器 {属性名:属性值;属性名:属性值;......}</style>
Copy after login

Example:

<style>
  bdoy{font-size:14px;} 
</style>
Copy after login

3. External style (external style): written in css file.

You can use to introduce css files into HTML pages.

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

Advantages of using CSS styles:

CSS helps achieve responsible web design. CSS has a huge impact on how developers build Web sites, and the impact is likely to be endless. Moving most or even all of the presentation information of a web page out of HTML or XML files and keeping them in a style sheet has many advantages, such as reducing file size, saving network bandwidth, and ease of maintenance.

In addition, the performance information of the site is separated from the core content, allowing the site designers to make various modifications to the entire website in a short period of time.

CSS simplifies the format code of the web page, and the external style sheet will also be saved in the cache by the browser, speeding up the download and display speed, and also reducing the amount of code that needs to be uploaded (because repeated formatting will is saved only once).

As long as you modify the CSS style sheet file that stores the website format, you can change the style and characteristics of the entire site. It is particularly useful when modifying a site with a large number of pages. This avoids modification of web pages one by one and greatly reduces the workload.

Recommended learning: css video tutorial

The above is the detailed content of What are the styles of css?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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