Vertical Alignment

前端 未结 4 2082
隐瞒了意图╮
隐瞒了意图╮ 2021-01-15 03:57

Please take a look at this: http://sources.freehosting.bg/landing.html

I am trying to vertically align #content so it looks good on larger (1920x1200) and smaller (1

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-15 04:52

    If your content height is fixed put a div before the content

    Vertically centered :D

    and style it like:

    html, body {
    height:100%;
    margin:0;
    padding:0;
    }
    
    div#distance {
    width:1px;
    height:50%;
    margin-bottom:-300px; /* half of website height */
    float:left;
    }
    
    div#content {
    text-align:left;
    margin:auto;
    position: relative;
    width: 950px;
    height: 600px;
    clear: left;
    }
    

提交回复
热议问题