CSS Basics, selectors

Source: Internet
Author: User

First, CSS:
is a cascading style that is used to beautify the page
second, the difference between HTML and CSS
HTML effect:
determines the content and structure of the Web page
CSS Effect:
beautify the Web page, specifically to beautify and decorate the HTML tag .
Third, CSS syntax:
Selector {
Attribute 1: value 1;
attribute 2: value 2;
          }      
four, the basic selector:
HTML tag Selector, class selector, ID selector

HTML Tag Selector:
when declaring: The selector name is the HTML tag name, which must be the tag names that exist on the page .
application: Automatically apply on this class tag
Application Range:
the same style is used throughout the page for all of these tags, which means
HTML tags re-used on similar tags

class Selector
when declaring: Name with "." Any name that starts with
when applied: Apply with the class attribute of the HTML tag, specifying the class selector name without adding "."
Application Range:
class selectors can be applied on any tag, and can be reused multiple times
NOTE: Class selectors take precedence over HTML tag selectors

ID Selector
when declaring: Any name with the name beginning with "#"
when applied: Use the id attribute of the HTML tag to specify the class selector name without adding "#"
Application Range:
The ID selector can be applied on any tag but not reused on the same page and applied only on one tag

Priority level:
ID selector > class selector >html tag Selector

CSS Basics, 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.