having prblem with using layer to overlay

Discussion in 'CSS' started by ankir, Jul 15, 2010.

  1. #1
    here is my code:
    <html>
    <title>
    css and html
    </title>

    <body>

    <div style=" background-color:red; height:100px;width:100px;postion:relative; top:10px; left:80px; z-index:1;">
    </div>

    <div style="background-color:yellow; height:100px; width:100px; postion:relative; top:30px;left:35px; z-index:2;">
    </div>

    </body>
    </html>

    according to the code it should the two colors should overlay. instead it is showing one and second in series. i tried to run in chrome also but it doesn't help.please guide
     
    ankir, Jul 15, 2010 IP
  2. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The div you want to be on top needs to be positioned absolutely, not relatively.
     
    Deacalion, Jul 15, 2010 IP
  3. ankir

    ankir Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i wrote absolute previously but doesn't work also.
     
    ankir, Jul 16, 2010 IP