开发者

Position two images. One top right, the the other bottom left

开发者 https://www.devze.com 2023-02-14 01:06 出处:网络
Please can some one help me with ALIGNING one image on the BOTTOM LEFT and the other image on the TOP RIGHT. So i have one basic page... two images and i want them diagonally opposite from each o开发者

Please can some one help me with ALIGNING one image on the BOTTOM LEFT and the other image on the TOP RIGHT. So i have one basic page... two images and i want them diagonally opposite from each o开发者_C百科ther. Very simple but every thing i have tried just makes both images align on the right....


Here's one solution that involves absolute positioning. It can get tricky to coordinate multiple entities, but it's pretty flexible if you want an exact layout.

<div style="position: relative; width: 300px; height: 300px;">
    <div style="position: absolute; background-color: red; width: 100px; height: 100px; left: 0px; top: 0px;">Top Left</div>
    <div style="position: absolute; background-color: blue; width: 100px; height: 100px; right: 0px; bottom: 0px;">Bottom Right</div>
</div>

http://jsfiddle.net/UedkS/

0

精彩评论

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

关注公众号