CSS basic syntax and selectors

Source: Internet
Author: User

CSS is a cascading style sheet (cascading style sheets), a style that defines how HTML elements are displayed, and is a language that truly enables Web performance and content categorization.

"1" CSS basic syntax

"2" CSS two ways to combine

"3" several selectors

Basic syntax

The basic syntax is also two, in the head using Selector selection, and then used in body, the following style property key: Style attribute value 1 Style property value 2 ... is a conjunction of multiple property values.

<! DOCTYPE html>


two ways to combine

<! DOCTYPE html>

Tag Selector

Using HTML tags, such as P, H1, A, etc., can also be HTML

<span style= "FONT-SIZE:18PX;" ><! DOCTYPE html>


ID Selector

Specifying styles in a way that is independent of document elements

<! DOCTYPE html>


class Selector

In fact, the class selector is similar to the ID selector.

<! DOCTYPE html>


Pseudo class Selector

This can control some of the status of the label, with other selectors to use together

<! DOCTYPE html>


Composite Selector

By combining IDs, classes, and elements together, you can see that they are used separately in the body and are combined in a style.

<! DOCTYPE html>


CSS basic syntax and selectors

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.