search

What does css mean?

Apr 27, 2021 pm 03:22 PM
css

css stands for Cascading Style Sheets, and its full English name is "Cascading Style Sheets". It is a computer language used to express file styles such as HTML or XML. CSS can not only statically modify web pages, but also cooperate with various Scripting languages ​​dynamically format various elements of a web page.

What does css mean?

The operating environment of this article: windows7 system, css3 version, Dell G3 computer.

Cascading Style Sheets (English full name: Cascading Style Sheets) is a computer used to express document styles such as HTML (an application of Standard Generalized Markup Language) or XML (a subset of Standard Generalized Markup Language). language. CSS can not only statically modify web pages, but can also cooperate with various scripting languages ​​to dynamically format various elements of web pages.

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.

Language Features

CSS provides a style description for the HTML markup language and defines how elements are displayed. CSS is a breakthrough in the field of web design. It can be used to modify a small style to update all page elements related to it.

In general, CSS has the following characteristics:

  • Rich style definitions

CSS provides rich document styles Appearance, and the ability to set text and background properties; allows the creation of a border for any element, as well as the distance between the element's border and other elements, and the distance between the element's border and the element's content; allows you to freely change the capitalization, decoration, and Other page effects.

  • Easy to use and modify

CSS can define styles in the style attribute of HTML elements or in HTML documents. In the header part, the style can also be declared in a special CSS file for reference by the HTML page. In short, CSS style sheets can store and manage all style declarations in a unified manner.

In addition, elements of the same style can be classified and defined using the same style, you can also apply a certain style to all HTML tags with the same name, or you can assign a CSS style to a certain in page elements. If we want to modify the style, we only need to find the corresponding style statement in the style list and modify it.

  • Multi-page application

CSS style sheet can be stored in a separate CSS file, so that we can use the same A CSS style sheet. Theoretically, CSS style sheets do not belong to any page file and can be referenced in any page file. In this way, the styles of multiple pages can be unified.

  • Cascading

Simply put, cascading is to set the same style multiple times on an element, which will use the last attribute value set. . For example, if you use the same set of CSS style sheets for multiple pages in a site, and if you want to use other styles for some elements in some pages, you can define a separate style sheet for these styles and apply them to the page. These styles defined later will override the previous style settings, and what you see in the browser will be the style effect set last.

  • Page compression

In websites that use HTML to define page effects, a large number or repeated tables and font elements are often required to form various specifications. The result of this is that a large number of HTML tags will be generated, which will increase the size of the page file. Putting the style declaration separately in the CSS style sheet can greatly reduce the size of the page, so the time spent loading the page will also be greatly reduced. In addition, the reuse of CSS style sheets reduces the size of the page to a greater extent and reduces the download time.

[Recommended learning: css video tutorial]

Language basics

Attributes and attribute values

Attributes

The name of an attribute is a legal identifier, and they are keywords in CSS syntax. An attribute specifies an aspect of formatting. For example: color is the color attribute of the text, and text-indent specifies the indent of the paragraph.

To master the usage of an attribute, there are six aspects that need to be understood. The specific description is as follows:

①The legal value of this attribute (legal value). Obviously the paragraph indent attribute text-indent can only be assigned a value indicating the length, and the value indicating the background pattern. The image attribute should take a value indicating the image location link or the keyword none to indicate no background pattern.

②The default value of this attribute (initial value). When this attribute is not specified in the style sheet and the attribute cannot be inherited from its parent element, the browser will assume that the attribute takes its default value.

③The elements to which this attribute applies (Applies to). Some attributes only apply to certain individual elements. For example, the white-space attribute only applies to block-level elements. The white-space attribute can take three values: normal, pre and nowrap. When set to normal, the browser will ignore consecutive whitespace characters and only display one whitespace character. When pre is taken, consecutive whitespace characters are retained. When taking nowrap, consecutive whitespace characters are ignored and line wrapping is not performed automatically.

④Whether the value of this attribute is inherited by the next level.

⑤If the attribute can take a percentage value, how will the percentage value be interpreted? That is, what is the standard relative to the percentage value. For example, the margin attribute can take a percentage value, which is the width of the container relative to the element where the margin is stored.

⑥The media type group (media groups) to which this attribute belongs.

Attribute value

①Integers and real numbers

This is not much different from integers and real numbers in the ordinary sense. Only floating point decimals can be used in CSS, and scientific notation cannot be used to represent real numbers like other programming languages. That is, 1.2E3 will be illegal in CSS. Here are a few correct examples, integers: 128, -313, real numbers: 12.20, 1415, -12.03.

②Length quantity

A length quantity consists of an integer or real number plus the corresponding length unit. Length quantities are often used to position elements. Positioning is divided into absolute positioning and relative positioning, so the length unit is also divided into relative length unit and absolute length unit.

The relative length units are: em - the height of the current font, which is the value of the font.size attribute; ex - the height of the lowercase letter x in the current font; Dx - the length of one pixel, its actual The length is determined by the monitor settings.

Another point worth noting is that child elements do not inherit the relative length values ​​​​of parent elements, only their actual calculated values.

③Percentages

Percentages are numbers plus a percent sign. Obviously, percentages are always relative, so like relative lengths, percentages are not inherited by child elements. [10]

Selector

Type selector

A selector in CSS is the name of the element type. Using this selector (called a type selector), a declaration can be applied to every instance of this element type. For example, the selector of the following simple rule is H1, so the rule applies to all H1 elements in the document:

H1 {color:red}

Simple attribute selector

CLASS attribute

The CLASS attribute allows a declaration to be applied to a group of elements that have the same value on the CLASS attribute. All elements within BODY have the CLASS attribute. Essentially, you use the CLASS attribute to classify elements, create rules in your style sheet to reference the value of the CLASS attribute, and then the browser automatically applies those attributes to that group of elements.

The class selector starts with an identifier (period), which is used to indicate which type of selector follows. For the class selector, the period was chosen because in many programming languages ​​it is associated with the term "class". Translated into English, an identifier means "an element with a class name".

ID attribute

The operation of the ID attribute is similar to the CLASS attribute, but there is one important difference: the value of the ID attribute must be unique in the entire document. This allows the ID attribute to be used to set style rules for individual elements. A selector containing an ID attribute is called an ID selector.

It should be noted that the identifier of the ID selector is the hash symbol (#). The identifier is used to remind the browser that what comes next is an ID value.

STYLE attribute

Although CLASS and ID attribute values ​​can be used in selectors, the STYLE attribute can actually replace the entire selector mechanism. Rather than just having a value that can be referenced in a selector (which is what ID and CLASS have), the value of the STYLE attribute is actually one or more CSS declarations.

Normally, with CSS, the designer will place all style rules in a style sheet, which is located within the STYLE element at the top of the document (or linked externally). However, using the STYLE attribute enables you to bypass the style sheet and place the declaration directly into the opening tag of the document.

Combined selector types

Type selectors, ID selectors and class selectors can be combined into different selector types to form more complex selectors. By combining selectors, you can be more precise with the elements you want to give a certain representation to. For example, to combine a type selector and a class selector, an element must meet two requirements: it must be the right type and the right class so that style rules can act on it.

External information: pseudo-classes and pseudo-elements

In CSS1, styles were usually based on tags and attributes that appeared in the HTML source code. This approach is perfectly fine for many design situations, but it fails to achieve some common design effects that designers want to achieve.

Designing pseudo-classes and pseudo-elements can achieve some of these effects. These two mechanisms expand the expressive capabilities of CSS. In CSS1, pseudo-classes were used to change the style of links in a document based on circumstances such as whether the link was accessed, when it was accessed, and how the user interacted with the document. With the help of pseudo-elements, you can change the style of the first letter and first line of an element, or add elements that do not appear in the source document.

Neither pseudo-classes nor pseudo-elements exist in HTML; that is, they are not visible in HTML code. Both mechanisms have been carefully designed to be further expanded in future versions of CSS; that is, to achieve more effects.

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

Statement
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
HTML and React's Integration: A Practical GuideHTML and React's Integration: A Practical GuideApr 21, 2025 am 12:16 AM

HTML and React can be seamlessly integrated through JSX to build an efficient user interface. 1) Embed HTML elements using JSX, 2) Optimize rendering performance using virtual DOM, 3) Manage and render HTML structures through componentization. This integration method is not only intuitive, but also improves application performance.

React and HTML: Rendering Data and Handling EventsReact and HTML: Rendering Data and Handling EventsApr 20, 2025 am 12:21 AM

React efficiently renders data through state and props, and handles user events through the synthesis event system. 1) Use useState to manage state, such as the counter example. 2) Event processing is implemented by adding functions in JSX, such as button clicks. 3) The key attribute is required to render the list, such as the TodoList component. 4) For form processing, useState and e.preventDefault(), such as Form components.

The Backend Connection: How React Interacts with ServersThe Backend Connection: How React Interacts with ServersApr 20, 2025 am 12:19 AM

React interacts with the server through HTTP requests to obtain, send, update and delete data. 1) User operation triggers events, 2) Initiate HTTP requests, 3) Process server responses, 4) Update component status and re-render.

React: Focusing on the User Interface (Frontend)React: Focusing on the User Interface (Frontend)Apr 20, 2025 am 12:18 AM

React is a JavaScript library for building user interfaces that improves efficiency through component development and virtual DOM. 1. Components and JSX: Use JSX syntax to define components to enhance code intuitiveness and quality. 2. Virtual DOM and Rendering: Optimize rendering performance through virtual DOM and diff algorithms. 3. State management and Hooks: Hooks such as useState and useEffect simplify state management and side effects handling. 4. Example of usage: From basic forms to advanced global state management, use the ContextAPI. 5. Common errors and debugging: Avoid improper state management and component update problems, and use ReactDevTools to debug. 6. Performance optimization and optimality

React's Role: Frontend or Backend? Clarifying the DistinctionReact's Role: Frontend or Backend? Clarifying the DistinctionApr 20, 2025 am 12:15 AM

Reactisafrontendlibrary,focusedonbuildinguserinterfaces.ItmanagesUIstateandupdatesefficientlyusingavirtualDOM,andinteractswithbackendservicesviaAPIsfordatahandling,butdoesnotprocessorstoredataitself.

React in the HTML: Building Interactive User InterfacesReact in the HTML: Building Interactive User InterfacesApr 20, 2025 am 12:05 AM

React can be embedded in HTML to enhance or completely rewrite traditional HTML pages. 1) The basic steps to using React include adding a root div in HTML and rendering the React component via ReactDOM.render(). 2) More advanced applications include using useState to manage state and implement complex UI interactions such as counters and to-do lists. 3) Optimization and best practices include code segmentation, lazy loading and using React.memo and useMemo to improve performance. Through these methods, developers can leverage the power of React to build dynamic and responsive user interfaces.

React: The Foundation for Modern Frontend DevelopmentReact: The Foundation for Modern Frontend DevelopmentApr 19, 2025 am 12:23 AM

React is a JavaScript library for building modern front-end applications. 1. It uses componentized and virtual DOM to optimize performance. 2. Components use JSX to define, state and attributes to manage data. 3. Hooks simplify life cycle management. 4. Use ContextAPI to manage global status. 5. Common errors require debugging status updates and life cycles. 6. Optimization techniques include Memoization, code splitting and virtual scrolling.

The Future of React: Trends and Innovations in Web DevelopmentThe Future of React: Trends and Innovations in Web DevelopmentApr 19, 2025 am 12:22 AM

React's future will focus on the ultimate in component development, performance optimization and deep integration with other technology stacks. 1) React will further simplify the creation and management of components and promote the ultimate in component development. 2) Performance optimization will become the focus, especially in large applications. 3) React will be deeply integrated with technologies such as GraphQL and TypeScript to improve the development experience.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor