Tips about CSS usage

Tips About Css

usage of calc()

  • for the content in calc, especially for operator + -, we need to keep space before or after them. otherwise, they will not be regonized by browser.
    *{
        width:calc(2.1% + 40px);
    }

usage of Line-height

line-height:2, image we have a single line in the middle of the text we target. 2/2=1Xown-font-sizespace will be above, and same below. So, if we don't specify
the height of the element, the text will always be vertical center, if we spedify it, we can keep the line-height same to the height to keep content vertical center.

posted @ 2017-08-29 21:23  kongshu  阅读(240)  评论(0编辑  收藏  举报