header wrapper re

This question already has an answer here:

  • How do I vertically center text with CSS? 34 answers

  • You could simply add text-align: center to the parent element. The img will respect this because it is inline by default.

    Updated Example

    header {
        background-image: url("http://lorempixel.com/400/200");
        background-size: 100% 100%;
        height: 100px;
        text-align: center;
    }
    

    See this answer for alternative approaches.


    这应该做到这一点,如果你所需要的只是保持图标居中,那么你并不需要绝对定位它。

    header {
        background-image: url("http://lorempixel.com/400/200");
        background-size: 100% 100%;
        height: 100px;
        text-align: center;
    }
    
    #home {
       margin-top: 10px;
    }
    

    尝试这个,

    #home {
    position:absolute;
    top:10px;
    left:48%;
    }
    
    链接地址: http://www.djcxy.com/p/41674.html

    上一篇: 如何防止vim创建(和离开)临时文件?

    下一篇: 头封装重新