Table elements: max-width |
Table elements: max-width |
Brian Chandler |
Nov 21 2021, 02:42 PM
Post
#1
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
On my 'about cookies' page: https://imaginatorium.com/cookies.html ... I want to set a maximum width for the "value" column. This contains a basket, which might be long (to see this you need to go to a random page and click lots of 'Add to basket' links), and if this is really long the table ends up the full width of the browser, whereas I would prefer to wrap the cookie values.
I tried setting th style='max-width: 20em' but this had no effect. (I found stackoverflow answers suggesting this.) So I have set 'width: 20em', but this fixes the width. I seem to remember getting stuck on this a month or so ago, and believed that the point was that for tables "width" really means "min-width', because tables stretch to contain their content. But actually, setting width "works", and the text just flows within it. In the end I found the w3 thing: https://www.w3.org/Style/css2-updates/css2/...#min-max-widths This appears to claim that setting max-width sets the maximum width. Well I wish I could see how to do that... |
Brian Chandler |
Nov 26 2021, 03:15 AM
Post
#2
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
Thanks for looking at this Christian. So it doesn't work. Well.
I can just use a fixed width, or I suppose since I want it to expand to the width of about 3 items in the "basket" cookie, I can just replace the first two spaces with nbsp... |
Lo-Fi Version | Time is now: 27th April 2024 - 09:04 PM |