Search code examples
csstwitter-bootstrap-3css-frameworksgrid-system

Fixed height + vertically aligned


I am having trouble getting a fixed height sections plus vertically aligned elements to follow grid responsive behavior. Only constraint is that sections should have a fixed size.

I have seen examples on SO but it breaks columns stacking behavior.

See attached jpeg on what I am trying to accomplish.

grid layout


Solution

  • You can use position relative.

    section {
      height: 100px;
      line-height: 100px;
      border: 1px solid black;
    }
    
    div {
      border: 1px solid red;
      height: 50px;
      position: relative;
      top: 25%;
    }
    <section>
      <div>
      </div>
    </section>