Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Newer construct for width in XHTML?

I built a table like this:

<table width="100%" border="0">
    <tr>
        <td width="20%">
            Nombre
        </td>
    </tr>
</table>

but I have a warning "Validation (XHTML 1.0 Transitional): Attribute 'width' is considered outdated. A newer construct is recommended"

What is a Newer construct for width in XHTML?

like image 554
Refu Avatar asked Nov 10 '12 08:11

Refu


2 Answers

The width attribute for <td> has been deprecated.

You should replace the width attribute with the CSS width property:

<table width="100%" border="0">
    <tr>
        <td style="width: 20%;">
            Nombre
        </td>
    </tr>
</table>
like image 122
Andrew Avatar answered Nov 01 '22 17:11

Andrew


Use only CSS attributes:

<table style="width:100%; border:0px;">
    <tr>
        <td style="width:20%;">
            Nombre
        </td>
    </tr>
</table>
like image 22
Daniel Ezra Avatar answered Nov 01 '22 17:11

Daniel Ezra