I would like to create a table with not fixed width.
The width depends on the text length inside.

But later I would like to create another table with the same width.
It is possible?

Recommended Answers

You could try to put them both in a div, with the div's width:auto, and the tables a maximum width. Or you could the width of the second table to the width of the first table with javascript (onload).

Jump to Post

All 3 Replies

You could try to put them both in a div, with the div's width:auto, and the tables a maximum width. Or you could the width of the second table to the width of the first table with javascript (onload).

How to do this second one ?

Give them both and id:

document.getElementById('id2').style.width = document.getElementById('id1').innerWidth + 'px';

Or something like that - not tested.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.