HTML encoding and CSS encoding will encounter the question

Source: Internet
Author: User
Tags css preprocessor

http://codeguide.bootcss.com/#html-syntax Reference link

Attribute Order

HTML attributes should be arranged in the order given below to ensure readability of the code.

    • Class
    • ID, name
    • data-*
    • SRC, for, type, href
    • Title, Alt
    • aria-*, role

Class is used to identify highly reusable components and should therefore be ranked first. ID is used to identify specific components and should be used with caution (for example, bookmarks within a page), so it is ranked second.

Declaration Order

The related attribute declarations should be grouped into groups and arranged in the following order:

    1. Positioning
    2. Box model
    3. Typographic
    4. Visual

Because positioning (positioning) removes elements from the normal flow of documents and also overrides the box model-related styles, it is ranked first. The box model is ranked second because it determines the size and position of the component.

Other properties only affect the interior of the component (inside) or do not affect the first two sets of properties, so it is followed.

Do not use @import

@import instructions are much slower than the <link> tag, not only increasing the number of requests, but also causing unforeseen problems. There are several alternatives to this approach:

    • Use multiple <link> elements
    • Compile multiple CSS files into a single file by using a CSS preprocessor similar to Sass or less
    • CSS file merging provided through Rails, Jekyll, or other systems
Editor configuration

Set up your editor according to the following configuration to avoid common code inconsistencies and differences:

    • Use two spaces instead of tabs (Soft-tab is a space for tab characters).
    • When you save the file, remove the trailing white space character.
    • Set the file encoding to UTF-8.
    • Add a blank line at the end of the file.

HTML encoding and CSS encoding will encounter the question

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.