What is CSS

Source: Internet
Author: User

CSS is the abbreviation for cascading Style sheet. Translated "cascading style sheets". is a markup language for (enhanced) Control of Web page styles and allows the separation of style information from Web page content. CSS styles can be used to control many properties that only use HTML to control. HTML is a kind of markup language. When an HTML page is opened in a browser, the browser reads the HTML tags in the page and renders the page elements based on the built-in parsing rules. CSS (cascading style sheets) determines how the browser will describe the representation of an HTML element. In other words, CSS is the rule that describes HTML elements. CSS is currently the latest version of CSS3,CSS can be based on the understanding of different users, simplifying or optimizing the writing, for all types of people, have a strong legibility.

CSS Cascading style sheets are a series of formatting rules that control the appearance of Web page content. When you use CSS to format a page, you can separate the content from the representation. Web page content (that is, HTML code) resides in the HTML file itself, while the CSS rules that define the representation of the code reside in another file (an external style sheet) or another part of an HTML document (usually the header portion of the file). CSS gives you more flexibility in controlling the appearance of specific pages, from precise layouts to specific fonts and styles.

CSS allows you to control many properties that HTML cannot control on its own. For example, you can specify different font sizes and units (pixels, points, and so on) for the selected text. CSS allows you to set the font size in pixels, ensuring that the layout and appearance of the page are handled more consistently in multiple browsers. In addition to formatting text, you can use CSS to control the formatting and positioning of block-level elements in a Web page. For example, you can set the margins and borders of block-level elements, floating text around other text, and so on.

CSS formatting rules consist of selectors and declarations, where selectors are terms that identify formatting elements (such as p, H1, class names, or IDs), and declarations are used to define element styles.

The main advantage of CSS is that it provides convenient update functionality. When you design a Web site, you can create a CSS style sheet file, and then connect all the pages in your Web site to the stylesheet file, which makes it easy to provide a consistent look and feel for all pages within the Web site. When you update a style property, the formatting of all pages that use that style is automatically updated to the new style without having to modify it one page at a time.

In the actual application, there are three kinds of cascading methods generally.

1. External-linked
In an out-of-the-box style sheet, the CSS code is stored separately as a file, including all styles in the Style.css file. External cascading in HTML is introduced using the <link> tag or @import statement. The sample code is as follows:

<link rel= "stylesheet" href= "Style.css" type= "text/css"/>//link link
@import url ("Style.css"); @import Import

The similarities and differences between <link> and @import can be consulted in this article: the difference between link and @import in the external reference of CSS.

2. Inline type
The CSS code for the portal site is usually embedded, commonly referred to as inline style, which uses the <style> tag to define the style as an inner block object. The sample code is as follows:

<style type= "Text/css" >
<!--
Body
-
</style>

Inline CSS can effectively reduce HTTP requests, improve page performance, and relieve server stress. Since the browser has finished loading CSS to render the page, it prevents the page from being read by the CSS file.

3. Embedded
The first level of CSS notation is to add code directly to the decorated markup element. The sample code is as follows:

<div style= "FONT-FAMILY:ARIAL,HELVETICA,SANS-SERIF;" > Mango </div>

This is more intuitive, but to a large extent, the page volume is increased, does not conform to the structure and performance of the design concept of separation.

Overall, there are advantages of both outreach and inline, which can be combined to select the appropriate Cascade method.

The above content is part of the network. If there is infringement, please notify immediately after deletion.

What is CSS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.