Help:Table/Width: Difference between revisions

Content deleted Content added
clarify
 
(11 intermediate revisions by 3 users not shown)
Line 5:
These example tables need to be on this separate page in order to test them more easily in narrower browser windows. Test them in both desktop and mobile views (on cell phones in portrait orientation). See the mobile or desktop view link at the bottom of this Wikipedia page. Use a cell phone to get the true mobile view.
 
In desktop view on a PC '''narrow your browser window.''' On a Wikipedia page that has '''only text (no tables)''' a '''horizontal scrollbar''' will show up '''well before the text is unable to wordwrap further.''' For example see '''[[User:Timeshifter/Sandbox204|this sandbox]].''' "Lorem ipsum ..." is from [https://www.lipsum.com here].
 
== Line breaks ==
== CSS max-width on table as a whole ==
 
Line breaks '''<nowiki><br></nowiki>''' are OK to narrow header cells, and other cells. See Graham87 comments at [[Help talk:Table/Advanced#Line breaks in table cells]].
 
== Soft hyphens ==
 
'''{{tlx|shy}}''' can be placed in long header words like "population" to add a [[soft hyphen]] when the screen is narrow (as on portrait view on cell phones):
;Wikitext
:<code><nowiki>popu{{shy}}lation</nowiki></code>
;Which appears as
: population
;Except in narrow screens where it looks like this:
:popu-<br>lation
 
== CSS max-width on table as a whole ==
{{hatnote|'''Note:''' "Lorem ipsum ..." is from [https://www.lipsum.com here].}}
CSS max-width for overall table width '''works on both desktop and mobile.''' And it shrinks further as screen or browser narrows. Portrait versus landscape view on cell phone.
 
''';Overall table width attempted via max-width:'''
:<code>{| class=wikitable style="max-width:40em;"</code>
 
Line 60 ⟶ 74:
== Example. CSS width on table as a whole ==
 
CSS width for overall table width works on desktop ('''horizontal scrollbar''' if screen is too narrow for width setting). It is ignored altogether on these iphoneiPhone browsers: Edge, Chrome, Firefox, Opera. But not on iphoneiPhone Safari where it works the same as on desktop.
 
''';Overall table width:'''
:<code>{| class=wikitable style=width:50em</code>
 
Line 80 ⟶ 94:
CSS width for a table header cell acts like a max-width setting. So it shrinks as browser window shrinks. It shrinks proportionally on mobile, too. No horizontal scrollbar in either mode.
 
''';Center header width setting:'''
:<code>! Left !! style=width:40em | Center !! Right</code>