Results 1 to 4 of 4

Thread: question on tables

  1. #1
    Join Date
    May 2005
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default question on tables

    i am making a table, and when i do width="100%" it leaves a 20px margin on the right

  2. #2
    Join Date
    May 2005
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    here is the table thing


    <table border="1" width="100%" height="150px" style="position:absolute;top:0px;left:0px" bgcolor="white" cellpadding="0px">

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    User agents typically add a margin or padding to the body element of a document. This spacing isn't considered in the 100% calculation.

    The typical solution is to remove this spacing by way of CSS:

    Code:
    body {
      margin: 0;
      padding: 0;
    }
    The table will now span the entire width. Just remember that other elements will now be flush against the viewport edges, so you may need to add a margin to them.

    The start tag for your table element can now be simplifies somewhat to:

    HTML Code:
    <table border="1" width="100%" height="150" bgcolor="white" cellpadding="0">
    Notice that I omitted the units in the height and cellpadding attributes. Unlike in CSS, HTML attributes assume pixels and never require units. However, almost all presentational units have been deprecated from HTML 4 in favour of style sheets.

    Mike
    Last edited by mwinter; 05-30-2005 at 06:52 PM.

  4. #4
    Join Date
    May 2005
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thank you very much. it works

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
  •