The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Table elements: max-width
Brian Chandler
post 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...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Brian Chandler
post 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...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 12:55 PM