Change table to div

I have 4 simple html pages, in design, tables are used but I prefer div instead of table. Can anyone help me converting this from table to div?

I’m not sure what you’re asking here.

I may be wrong, but as far as I know, the only way to convert from a table layout to a div layout is to strip out all the old HTML - or at least the table tags (<tr>, <td> etc.) - and restructure your page using semantic markup.

If there’s an easier way than this, I wish I’d found it before now. :slight_smile:

You could theoretically do this with a search-replace; <div id=“td”> for <td>, <div id=“tr”> for <tr>, and so on, and style the elements using display: table-cell, display: table-row, and other table equivalents. While this would remove the semantic markup, it would not really make much sense in terms of taking advantage of what you can do with CSS.

As you said, it would be much better to re-structure the HTML from scratch. If the page is built with tables, it will likely have other artefacts of poor page design anyway, which could be remedied at the same time.

There isn’t one. At least not one that provides you with any actual benefit in making the change.

Better to move to div? Using tables are not recommended anymore nowadays?

Using tables is old-fashioned and not recommended anymore. It is much easier and more gently to build div based site.

Table-based layout is old school.

Tables must be used just for presenting and organizing data, and not for layout a website or any of its contents.

Moreover, I guess that nimasdj must be talking about an old lady, full of deprecated elements and even scripts, outdated in terms of design, functionality and user experience, among other things.

You’d better forget it and design a new site from scratch.