Difference between revisions of "Template:If mobile"
imported>Sdkb (adding noincluded example, since this is potentially buggy) |
imported>Evad37 (@User:Sdkb: No point in having noincludes, this only works outside of the Template: namespace) |
||
| (3 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
| − | <templatestyles src="If mobile/styles.css" /><{{{tag|{{{Tag|span}}}}}} class="ifmobile"><{{{tag|{{{Tag|span}}}}}} class="nomobile">{{{2| | + | <templatestyles src="If mobile/styles.css" /><{{{tag|{{{Tag|span}}}}}} class="ifmobile"><{{{tag|{{{Tag|span}}}}}} class="nomobile">{{{2|}}}</{{{tag|{{{Tag|span}}}}}}><{{{tag|{{{Tag|span}}}}}} class="mobile">{{{1|}}}</{{{tag|{{{Tag|span}}}}}}></{{{tag|{{{Tag|span}}}}}}><noinclude> |
{{Documentation}}</noinclude> | {{Documentation}}</noinclude> | ||
Latest revision as of 00:27, 24 December 2020
Script error: No such module "Uses TemplateStyles". This template detects whether it is being used on the mobile version of Wikipedia (en.m.wikipedia.org), and displays different content accordingly.
Rationale
Some features work differently on the mobile website, such as slideshow galleries appearing as ordinary galleries. This templates allows better presentation of such content, by e.g. having a "Slideshow" heading when a slideshow is shown, and a "Gallery" heading when a regular gallery is shown.
Usage
{{If mobile|content for mobile website|content for desktop website}}
By default, <span>...</span> tags are used to wrap the specified content. A different tag may be specified using |tag=
- E.g.
|tag=divcan be used if the content contains block-level elements.
| 40x40px | Note that {{If mobile}} only works outside of the Template: namespace. |
Example
{{If mobile|A mobile user you are!|You are looking at the desktop site}}
| The above documentation is transcluded from Template:If mobile/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |