Content deleted Content added
Timeshifter (talk | contribs) →CSS max-width on table as a whole: Note. Moved "Lorem ipsum" link to more logical ___location for this page, and these tables. |
Favre1fan93 (talk | contribs) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1:
__TOC__
See the '''[[Help:Table#Width|Width]]''' section of [[Help:Table]]. To summarize, '''max-width''' is the preferred way to limit widths on tables. It works on divs too. Note though that in both tables and divs there needs to be spaces in long lines of text or wikitext. Otherwise there is no point at which that line can wrap.
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]].'''▼
== Line breaks ==
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>
Line 8 ⟶ 20:
;Except in narrow screens where it looks like this:
:popu-<br>lation
▲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]].'''
== CSS max-width on table as a whole ==
Line 66 ⟶ 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
;Overall table width
|