What is css (cascading style sheets)?

青灯夜游
Release: 2019-05-23 18:16:56
Original
5817 people have browsed it

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

CSS is mainly used to set the appearance of the website to make our website more gorgeous and eye-catching; it can not only statically modify web pages, but also dynamically coordinate with various script languages. Format various elements of the web page.

CSS can perform pixel-level precise control over the layout of element positions in web pages, supports almost all font size styles, and has the ability to edit web page objects and model styles.

CSS style sheets define the color, size, and position of text and other HTML markup, while HTML files define content and how it is organized. Separating them allows you to change the color scheme without having to rewrite the entire site.

Cascading means that styles applied to the parent element will also be applied to all child elements in the parent element. For example, setting the color of the body text will mean that all headings and paragraphs in the body text will also be the same color.

Specifying and using styles

There are three main ways to include a web page or site style sheet:

1. Set theattribute of the tag, which is called inline style;

2. Use the

Copy after login

External Style Sheet

Like HTML files, CSS files are plain text and usually have a .css file extension; they can be passed through specific tags to link it into the HTML file.

Features:

1), written in a separate document and then attached to various Web documents

2), modifying it can affect all pages you call

3), easy to modify

For example, the content of the style.css file can be as follows:

body { background-color: beige; color: #000080;}
h1 { color: red;}
Copy after login

Then you can use The header is introduced to take effect.




Copy after login

Most websites today use external style sheets. External styles are styles that are written in separate documents and then attached to various web documents. External style sheets affect any files they are connected to, meaning if you have a 20 page website and every page uses the same style sheet, when changes need to be made you can simply edit the style sheet to complete those pages. Makes long-term site management easier. The disadvantage of external style sheets is that they require the page to obtain and load these external files. Not every page will use every style in the CSS table, so many will load a much larger CSS page than is actually needed.

The above is the detailed content of What is css (cascading style sheets)?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!