Center a section that is inside a div with an image

This question already has an answer here:

  • How to make an image center (vertically & horizontally) inside a bigger div 36 answers

  • Try using this:

    div section {
        color: #FFFFFF;
        background-color: #456087;
        position: absolute;
        top:25%;
        left: 25%;
        bottom: 25%;
        right: 25%;
        opacity:0.3;
        filter:alpha(opacity=30%);
    }
    

    JsFiddle : http://jsfiddle.net/nfLyR/


    There are two ways:-

  • Please refer this SO How to make an image center (vertically & horizontally) inside a bigger div

  • You can give margin:TOP RIGHT BOTTOM LEFT to inner content(img, div, section etc..).

  • 链接地址: http://www.djcxy.com/p/75758.html

    上一篇: 你如何在一个div内垂直和水平居中一个div?

    下一篇: 以图片为中心放置在div内的部分