Make Div Stay In Top Of Parent
I have a 'problem' that at first sight didn't look like one.  So, I have a parent div containing to childs. The one child will contain text, and the other a picture. Both are inlin
Solution 1:
Try adding the CSS rule:
vertical-align:top;
to all your inline-block divs that you want top-aligned
Good luck!
Solution 2:
Rather than display: inline try float: left.
Solution 3:
There are a few different ways of doing this, they should all work.
1:
#parent > div{
    vertical-align: top;
}
2:
#parent{
    position: relative;
}
#parent > div{
    position: absolute;
    top: 0px;
}
3:
#parent > div{
    float: left;
}
Solution 4:
#parent > div {vertical-align: top}
Solution 5:
You can ALWAYS do it with absolute positioning although this usually causes issues down the road, try and stick to relative positioning.
#parent {
   border: 2px solid green;
   width: 504px;
   margin: 0px;
   padding: 0px;
   position: relative;
   float: left;
}
#child1 {
  position: absolute;
  top: 0px;
  float: left;
  height: 279px;
  color: white;
}
#child2 {
  position: absolute;
  top: 0px;
  float:left;
}
Post a Comment for "Make Div Stay In Top Of Parent"