how to place last div into right top corner of partent div? (css)

Posted by Radek on Stack Overflow See other posts from Stack Overflow or by Radek
Published on 2010-05-16T02:09:26Z Indexed on 2010/05/16 2:20 UTC
Read the original article Hit count: 369

can I somehow using css place the block2 in right top corner of block1? screen shot

Note that block2 must be the (very) last inside html code of block1 or it could be placed after block1. I cannot make it the first element in block1

    <html>
      <head>
      <style type="text/css">
      .block1 {color:red;width:100px;border:1px solid green;}
      .block2 {color:blue;width:70px;border:2px solid black;position:relative;}

      </style>
      </head>

    <body>
    <div class='block1'>
    <p>text</p>
    <p>text2</p>

    <div class='block2'>block2</DIV>
    </div>

    </body>
    </html>

© Stack Overflow or respective owner

Related posts about css-layout

Related posts about css-positioning