SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Mike Borozdin's Avatar
    Join Date
    Oct 2002
    Location
    Edinburgh, UK
    Posts
    1,743
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Margin problems!

    I have this code:
    Code:
    <html>
    <head>
    <title>funkN</title>
    <link rel = "stylesheet" href = "style.css">
    <meta http-equiv = "Content-Type" content = "text/html; charset = iso-8859-1">
    </head>
    <body leftmargin = "0" topmargin = "0" marginwidth = "0" marginheight = "0" background = "images/watermark.gif">
    <div style = "width: 100%; background-image: url(images/navbot.gif); background-repeat: repeat-x;">
    </div>
    <div style = "float: left;">
      <img src="images/funknstrip.gif" width="126" height="32" hspace="18" align="absmiddle" alt="FunkN.....Real Estate in CyberSpace">
    </div>
    <div style = "float: right; margin-right: 10;">
    <a href = "#">join here</a> | <a href = "login.htm">my
    	  account</a> | <a href = "terms.htm">terms &amp; conditions</a>
    	  | <a href = "privacypolicy.htm" target = "main">privacy policy</a>
    </div>
    <div style = "clear: left; width: 100%; background-color: #000099; background-image: url(images/navtop.gif); background-repeat: repeat-x;">
    </div>
    <div style = "width: 100%; background-color: #000099;">
    </div>
    <div style = "width: 100%; background-image: url(images/navbot.gif); background-repeat: repeat-x;">
    </div>
    <div style = "margin-top: 10; margin-left: 10;">
      <div style = "float: left; width: 20%;">
      Login<br />
      Password
    </div>
    <div style = "float: right; width: 80%; margin-top: 0; margin-left: 0;">
    <form method = "POST" action = "<?=$_SERVER["PHP_SELF"]?>?action=logIn">
      <input type = "text" name = "login"><br />
      <input type = "password" name = "password">
    </form>
    </div>
    </div>
    </body>
    </html>
    There's a container-div that contains other elemets, I setted margin attributes there but since that time there're problems with contained divs. Margin attributes seemed to be inherited by them. What should I do? I want a small gap between left border of the screen and between menu to be.

  2. #2
    SitePoint Wizard Mike Borozdin's Avatar
    Join Date
    Oct 2002
    Location
    Edinburgh, UK
    Posts
    1,743
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I figured it out! I added a width attribute to the container, so it's working now!

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,296
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    I'm not sure what you mean. If you're talking about the part in bold in your post where you have wrapped your elements in this line:
    <div style = "margin-top: 10; margin-left: 10;">
    Then of course the inner elements will be inside this container which is 10px from the left margin. (BTW you must specify a size unit otherwise it will be treated as zero by mozilla.)

    The inner elements should have their default margins but will be relative to their container. If you want elements tight against the left hand side of the window then you have to put them there. Either take them out of the container or place them there absolutely.

    I don't think I've really understood the question properly anyway, so you may need to explain it a little more clearly

    Also I don't think your php statement is correct. (The double quotes inside double quotes is definately incorrect and should be single quotes inside not double.)

    Anyway, hope some of this is of use.

    Paul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •