开发者

How to push the right side elements to the top

开发者 https://www.devze.com 2022-12-24 07:24 出处:网络
I have 2 columns, one of them I float to the left and the other I float to the right. The r开发者_StackOverflowight side has input buttons on them.

I have 2 columns, one of them I float to the left and the other I float to the right.

The r开发者_StackOverflowight side has input buttons on them.

For some reason the buttons are kind of in the middle of the column, I want them to be vertically aligned all the way to the top and to the right.

How can I do this? Is it just playing with padding?

<div id="blah">
  <div id="left">
    <ul><li></li></ul>
</div>
  <div id="right"><input type=image src="" /> <input type=image src=""/></div>
</div>

The buttons are vertically aligned with the bottom of the UL.


You can wrap them with additional container with:

#buttons-wrapper: {
   position: absolute;
   top: 0;
}

(parent container should have position: relative)


First of all, you should only float the right div to the right, and have it before the left-div in mark-up. The other div will go the left automatically and you won't need any clearing divs after them.

Anyways, divs will have their contents vertically aligned top by default, if you want them right-aligned too, just add text-align: right; to the CSS.


have you tried:

#right-container
{
    vertical-align: top;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号