CSS Advanced Tips

Source: Internet
Author: User

Using CSS Reset

CSS Reset can maintain a consistent style style on different browsers. You can use the CSS Reset library normalize, etc., or you can use a more streamlined reset method: •

* {  box-sizing:border-box;   0 ;   0 ;}

Now that the element's margin and padding are 0, box-sizing you can manage the layout of your CSS box model.

Inherited  box-sizing

html inherit from element box-sizing :

HTML {  box-sizing:border-box;} *, *:before, *: After {  box-sizing:inherit;}
For bodyElement Add Row Height

You do not have to add the elements to each <p> element individually, and line-height add them directly to the body elements: ·

Body {  line1.5;}
Vertically center any element horizontally

Use elastic boxes to achieve

html, body {  %;    0 ;} Body {  -webkit-Flex;  Display:flex;  Justify-content:center; /* Center Horizontally */  /* Vertical Center Compatible */    align-items:center; /* Center Vertically */ }
Use Flexbox to remove excess margin
. list {  Display:flex;  Justify-content:space-between;}. List. person {  Flex%;} 

This article from: https://github.com/AllThingsSmitty/css-protips/tree/master/translations/zh-CN#table-of-contents

Featured Articles

    • 20 Useful CSS Tips
    • CSS sticks to 5 ways to fix the bottom
    • Mobile side CSS split evenly layout extension

CSS Advanced Tips

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.