Web Analytics Made Easy -
StatCounter How can I position a <div> relative to another? - CodingForum

Announcement

Collapse
No announcement yet.

How can I position a <div> relative to another?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I position a <div> relative to another?

    Here's my problem, I want to position a <div> layer 50px below another, the problem is that I dont know how big the other will be. Is there a way of making the position of the new <div> relative to the position of the origional?

  • #2
    Yes, ie.

    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd"
    >

    <
    html>
    <
    head>
    <
    meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <
    title>Untitled Document</title>

    <
    style type="text/css">
    #firstdiv { width: 500px; height: 200px; border: 1px solid #000; }
    #seconddiv { width: 500px; height: 200px; border: 1px solid #000; margin-top: 50px; }
    </style>

    </
    head>

    <
    body>
    <
    div id="firstdiv"></div>
    <
    div id="seconddiv"></div>
    </
    body>

    </
    html
    markaylward.co.uk

    Comment


    • #3
      [edit]

      nm, you've corrected the code.
      Why you should validate your code before asking for help...

      Comment


      • #4
        lol, yup realised I made a mistake.
        markaylward.co.uk

        Comment


        • #5
          so what happens if the first one is a variable size?

          Comment


          • #6
            Nothing happens... it changes size.
            markaylward.co.uk

            Comment

            Working...
            X