www.webdeveloper.com
Results 1 to 7 of 7

Thread: problem in HTML Table "border=0" it takes space

  1. #1
    Join Date
    Feb 2007
    Posts
    35

    Question problem in HTML Table "border=0" it takes space

    Hello,

    I will give the sample code of html. Here first table only apply border 1 width. other tables are border 0. The problem is border=0 means border was not visible but it takes white border space. I want to remove this space. How can I solve?

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <table border=1><tr><td>
    <table border=0><tr><td>
    <table border=0><tr><td>
    <table border=0><tr><td>
    <table border=0><tr><td>
    <table border=0><tr><td>
    MY TEST
    </td></tr></table>
    </td></tr></table>
    </td></tr></table>
    </td></tr></table>
    </td></tr></table>
    </td></tr></table>
    </div>
    </form>
    </body>
    </html>

  2. #2
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Untitled Page</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    MY TEST
    </div>
    </form>
    </body>
    </html>
    Stephen

  3. #3
    Join Date
    Feb 2007
    Posts
    35

    Cool It's Ok. But the problem is.....

    Hello,

    But I use the html page as table tag. I was give the sample code only. I want to remove table border space if I am set the attribute border=0.

  4. #4
    Join Date
    Nov 2006
    Location
    Nursing Home
    Posts
    268
    border=0 is depreciated code.

    you should be useing style="border:0;" but even that isn't best practice as its still inline styles.

    i suggest you STOP NOW! with what you are doing and do some WELL needed tutorials.
    http://www.w3schools.com/html/default.asp - simple html tutorial
    http://www.w3schools.com/xhtml/default.asp - simple xhtml tutorial
    http://www.w3schools.com/css/default.asp - simple CSS tutorial

    in the web development world now we separate presentation and content using style sheets.

    click on my signature or some of the other members of the forums signatures and view their source code and you will see how websites are supposed to be coded now days.

    HTML is to MARKUP (mark headings with heading tags, tables are for tabular data only etc...)
    CSS is for presentation/layout
    and when you get into serverside languages databases are for handling content

  5. #5
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    There is never any need to remove borders from tables where tables are being used correctly in the page. If your table needs the borders removed then you should remove the table completely and use the correct markup for the content.

    Where there is a legitimate use of tables (displaying tabular data) the chances of needing to nest a second table inside the first is less than one in a million and so if you are looking at having one table nested inside another then chances are your design is wrong. There is NEVER a need for three levels of tables (well maybe one in a googleplex) so if you are nesting three levels of tables then your page design is definitely wrong.
    Last edited by felgall; 02-13-2007 at 01:31 PM.
    Stephen

  6. #6
    Join Date
    Dec 2005
    Posts
    2,984
    I'm going to go ahead and assume those 72098530 tables you put above were to show us an example that nested tables still take up 'border' space even when there border is set to 0. And I'm also going to go ahead and assume that you would never use anything like this but are just naturally curious about your environment and found a quirk that you can't explain and (even though it never needs to be used letalone explained) you want to know the answer to it. Think about it, what other attributes might these tables have?

    (Hint: It's cellpadding and cellspacing)

    So I hope that answers your question and do yourself a favor and learn some CSS, if you haven't already.

  7. #7
    Join Date
    Sep 2012
    Posts
    1
    <style type="text/css">
    /* <![CDATA[ */

    table, td
    {
    border-color: #600;
    border-style: solid;
    }

    table
    {
    border-width: 0 0 1px 1px;
    border-spacing: 0;
    border-collapse: collapse;
    }

    td
    {
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
    background-color: #FFC;
    }

    /* ]]> */
    </style>

    http://visakopu.net/misc/table-border-css/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles