Search code examples
htmlcssw3c-validation

How to replace table attributes?


Well I have the following HTML:

<table cellspacing="0" cellpadding="0" width="100%">

So I validated my HTML document and I found that these are obsolete. But if I remove them my website alignment won't work as I want. I need a good enough way to replace the attrbutes with CSS code.


Solution

  •     <style type="text/css">
            .table1_style
            {
                border-collapse: collapse;
                border-spacing: 0px;
            }
            .table2_style
            {
                width: 100%;
            }
        </style>
    
    <table class="table1_style">
    <tr>
    <td>
    </td>
    </tr>
    </table>
    <table class="table2_style">
    <tr>
    <td>
    </td>
    </tr>
    </table>