Simple border

Discussion in 'CSS' started by Mitchell, Mar 10, 2009.

  1. #1
    Why won't the border go around the text? I use Firefox. See jpg. file attachment. Thanks.

    <!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" media="screen" href="facts02.css" >

    <title>Just the facts</title>

    </head>

    <html>
    <body>

    <div id="facts">
    <p>These are just the facts</p>
    </div><! -- facts -->

    </body>
    </html>


    CSS
    body {font-family:"Trebuchet MS", Verdana, sans-serif; background: rgb(120,130,140);}


    #facts { background: rgb(155,145,45);
    border-top: 1px solid #000000;
    border-bottom: 1px solid #000000;
    border-right: 1px solid #000000;
    border-left: 1px solid #000000;
    width: 400px; height: 20px; float: left;}
     

    Attached Files:

    Mitchell, Mar 10, 2009 IP
  2. DGK

    DGK Peon

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Probably the P element has some margin. Try without P and try also to set height:auto to the div element
     
    DGK, Mar 10, 2009 IP
  3. Mitchell

    Mitchell Peon

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That seemed to work. Thanks very much.
     
    Mitchell, Mar 11, 2009 IP