CSS style sheet Basic concepts

Source: Internet
Author: User

CSS, full name (cascading style Sheets, cascading style sheet), functions to beautify HTML pages.

Basic concept: is a markup language for (enhanced) Control of Web page styles and allows the separation of style information from Web content.

You may be unfamiliar with the term CSS, in fact, whether you use InternetExplorer or
Netscapenavigator surf the web, almost always with CSS, Web pages that do not use CSS may not be easy to find. No matter what work you use,
With the software to make Web pages, are intentionally or unintentionally using CSS. Use good CSS to make your Web pages more concise.

II. Basic Classification

1, inline style sheet (and HTML co-display, control accuracy, but reusability is poor, redundant)

Example: <p > Inline style sheet </p>

The above is a simple inline style sheet, used in <body> tags, the equivalent style attached to the label, only change the label p in the style and formatting.

2. Inline style sheet

Example: <style type= "Text/css" >

P//format works on P tags

{

Style

}

</style>

This is an inline style sheet, that is, the <style> style is extracted separately, placed in

3, external style sheet (obviously, is independent of the HTML file, but still need to call the external style sheet HTML to play its role)

You need to create a new CSS file to store the style sheet separately. When calling this style sheet in HTML, you need to right-click the HTML file---CSS style-attach the style sheet. When the connection succeeds, <link appears in HTML file

4, some labels have default margins, generally write style sheet code will be removed first (you can also set other styles), as follows:

<style type= "Text/css" >

*//format works on all labels

{

margin=0px;

padding=0px;

}

</style>

Third, selector

1. Single Selector

1) Tag Selector---selector with tag name

2) The class selector---all with "." Beginning

3) ID Selector---start with "#"

2. Composite Selector

1) separated by "," to indicate the juxtaposition

2) separated by spaces, indicating descendants

3) filter "."

CSS style sheet Basic concepts

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.