The width attribute on the table element is obsolete

Udemy - 30 Amazing Days of HTML and CSS Learning
30 Amazing Days of HTML and CSS Learning
Learn HTML & CSS and start creating your own websites within 30 days
1x1px

With HTML 4, you can specify the width of a table using the width attribute, e.g.: <table width="50%"> to specify the table should occupy 50% of the page width. However, with HTML5 specifying a table's width by that method has been deprecated. E.g., if you check your HTML code for adherence to the HTML 5 standard with the Nu Html Checker provided by the World Wide Web Consortium, you will see an error similar to the following one displayed if you are using "width=" within a table tag.

The width attribute on the table element is obsolete. Use CSS instead.
From line 102, column 1; to line 102, column 68
ow:↩<table class="dlgframe" width="50%" cellpadding="1" cellspacing="0">↩<tr>↩

You can achieve the same effect, while making your HTML code HTML 5 compliant, using the Cascading Style Sheets (CSS) code within the table tag:

<table class="dlgframe" style="width: 50%">

Or you could include the following style section in the HEAD section of the HTML code for the webpage, if all tables with a class of "dlgframe" on the page should occupy 50% of the webpage's width:

<style type="text/css">
   .dlgframe { width: 50% }
</style>

Related articles:

  1. Align attribute is obsolete
  2. Valign attribute is obsolete
  3. Equivalent for cellpadding in CSS

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px