CSS margin problem

Discussion in 'CSS' started by DK-Tandy, Aug 8, 2010.

  1. #1
    please check out this

    #div with margin bottom of the content set a a specific limit
    http://dk-tandy.co.uk

    #this is with NO specific limit
    http://dk-tandy.co.uk/hmm

    see how in the second link, the content and the footer fall in together!!

    whys this?


    EDIT: i have been told by a friend that he cant see the site, so it may not show and you will just see the /Index page :/
    i dont want to set a certain height because its a pain!!
     
    Last edited: Aug 8, 2010
    DK-Tandy, Aug 8, 2010 IP
  2. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #2
    This is one of the fix for your issue:

    You see there are two containers div "containers" are "sidebar" are using style "float:left" within a "main" container div. When you have floated div within a container div you'll have to clear the float.

    Example:
    
    <div id="main">
          <div id="content">
          Hello and welcome to DK-Tandy.co.uk, fvsfuvgufguygwetfartmhvgfehwagtrfgvweatmhujvgf vfuywergrtger greageshesg rwagherhes thrh<br>sdavsvsdvavsvgfaewgregagrg<br>rwagrgbebafEARGWRTBGHWavqrgrfag<br>afreggrGR<br>
          </div>
          <div id="sidebar">
          <strong>Links</strong><br><br>
          <a href="http://productdownloads.net">ProductDownloads</a><br>
          <a href="http://become-a-dj.info">Become-A-DJ</a><br>
          <a href="http://auctionadspace.net">AuctionAdSpace</a><br>
          </div>
    [COLOR="Green"]<div style="clear:both"></div>[/COLOR]
       </div>
    
    Code (markup):
     
    radiant_luv, Aug 8, 2010 IP
    DK-Tandy likes this.
  3. DK-Tandy

    DK-Tandy Active Member

    Messages:
    330
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    73
    #3
    ahh finally had time to try it and it worked perfectly!! +1 rep
     
    DK-Tandy, Aug 9, 2010 IP
  4. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #4
    Just to say hello.

    I would not use percentage for width and height. Give your div with the id navigation a fixed width, then add margin:0 auto; to the css and you have it centered.

    And the <br /> tag should not contain any spaces after the slash, now the xhtml code is valid.

    I have put width:520px; to the #navigation in the css file, deleted margin-left: 30%; and inserted margin:0 auto; and the menu centers well. ;-)

    Anyway, good luck with your site :) (nice colors btw).
     
    CSM, Aug 9, 2010 IP