这是什么树| 常喝黑苦荞茶有什么好处| 尿白细胞弱阳性什么意思| 里急后重吃什么药| 余沧海为什么是两个人| 上元节是什么节日| 什么呀| 牛油果有什么功效| 胃溃疡吃什么水果| 泌尿系统感染有什么症状| 潘多拉属于什么档次| 什么是遴选| 十的偏旁有什么字| 世事无常是什么意思| 1119是什么星座| crocs什么意思| 减肥什么方法最快最有效| 什么是天葬| 眼睑浮肿是什么原因| 需要一半留下一半是什么字| 肾结石发作有什么症状| 操逼是什么感觉| 什么叫化疗为什么要化疗| 07是什么生肖| 9月份怀孕预产期是什么时候| 风热感冒吃什么药最快| 必承其重上一句是什么| 梦见桥断了有什么预兆| 用什么自慰| 梦见自己被警察抓了是什么意思| 游车河什么意思| 27虚岁属什么生肖| 食管挂什么科| 考虑是什么意思| 大豆和黄豆有什么区别| 棘突是什么意思| 碧玺是什么意思| 抽烟有什么好处| 蜂蜜为什么不会变质| 小葱拌豆腐的下一句是什么| 长脓包是什么原因| 塌方是什么意思| 甲状腺功能亢进是什么意思| 看幽门螺旋杆菌挂什么科| ppm是什么意思| 白练是什么意思| 男性左下腹痛是什么原因| 吹气检查胃是检查什么| 上善若水是什么意思| 尾盘拉升意味着什么| 什么季节掉头发最厉害| 血小板低是什么症状| 狂躁症是什么| 梦见偷别人东西是什么意思| 暴饮暴食会得什么病| 未来的未多一横念什么| 膝盖疼痛挂什么科| 夏枯草长什么样| 月经不能吃什么东西| 靶身高是什么意思| 钱是什么意思| 白兰地属于什么酒| 凉烟都有什么牌子| 胸片是检查什么的| 尿蛋白可疑阳性是什么意思| 你在说什么用英语怎么说| 液化是什么意思| 手不什么| 梦见别人理发是什么意思| 中医把脉能看出什么| 什么是处女| 生化有什么症状和反应| 4月24号是什么星座| 无所不用其极是什么意思| 卡不当什么意思| cga是什么意思| 为什么会得耳石症| 什么是植物神经紊乱| 牙疼用什么药| 3月20号是什么星座| 天仙是什么意思| 反骨是什么意思| 层次是什么意思| 6.30是什么星座| 手上长斑点是什么原因| 什么越来越什么| 吃什么减肚子上的赘肉最快| 闲是什么生肖| 星星为什么眨眼睛| 感冒流鼻涕咳嗽吃什么药好| 尖锐湿疣是什么病| 包公是什么生肖| xo兑什么饮料好喝| 十六年是什么婚| 有机玻璃是什么| 朝阳是什么意思| 苦夏什么意思| 阴道里面瘙痒是什么原因| 什么的温度| 晞字五行属什么| 孕妇的尿液有什么用途| 为什么会得肩周炎| 狗狗打疫苗前后要注意什么| 12月8号什么星座| 梦见和亲人吵架是什么意思| 甲状腺不能吃什么| 超体2什么时候上映| 岔气吃什么药| 扁桃体有什么用| 白带是什么意思| 泻火是什么意思| 上善若水什么意思| 太阳花什么时候开花| 睡觉憋气是什么原因引起的| 洗发水和洗发露有什么区别| 身份证有什么用| 高血糖可以吃什么水果| 主动脉钙化是什么意思| 女生下面什么样| 中毒了吃什么解毒| 万马奔腾是什么意思| 日本是什么时候侵略中国的| 手脱皮是缺什么维生素| 任什么任什么| 氨水是什么东西| 西安有什么特色美食| 4月份什么星座| 什么的大娘| 让心归零是什么意思| 壁细胞主要分泌什么| 腹膜后是什么位置| 3月18号是什么星座| 宝齐莱算什么档次的表| 撒西不理是什么意思| 为什么会长疤痕疙瘩| 男怕初一女怕十五是什么意思| 少阳病是什么意思| 白色的猫是什么品种| 龟龄集适合什么人吃| 太阳筋疼是什么原因| 前列腺增生是什么原因引起的| 牙银肿痛吃什么药| 亚麻籽和什么相克| 大姨妈提前是什么原因| 毛尖茶属于什么茶| 悔教夫婿觅封侯是什么意思| 红是什么生肖| 为什么被蚊子咬了会起包| 紫色属于五行属什么| 翡翠和玉石有什么区别| 四气指的是什么| 偏头痛什么原因引起| 有志什么成| 谷氨酰转肽酶偏高是什么意思| 四个自信是什么| 六指是什么原因导致的| 胸部ct能检查出什么| 别无他求是什么意思| 10月20日什么星座| 什么人生病从来不看医生| 什么样的人不能献血| 不想吃油腻的东西是什么原因| 高血压吃什么最好| 凤凰单丛属于什么茶| 鲨鱼怕什么| 什么叫消融手术| 桔子什么时候成熟| 专科和本科有什么区别| 文曲星什么意思| 小孩满月送什么礼物好| 瞬息什么| 脑门发黑是什么原因| 柳絮吃了有什么好处| 脚底有痣代表什么意思| 刘邦为什么怕吕后| 多莉是什么鱼| 肝胃郁热吃什么中成药| 什么是上升星座| dickies是什么牌子| vdr是什么意思| 胆经不通吃什么中成药| 腹痛拉稀什么原因| 什么人容易得脑溢血| 高血压中医叫什么| 漏蛋白是什么原因造成的| 胃烧吃什么药| 危险是什么意思| 机场地勤是干什么的| 基围虾不能和什么一起吃| 桑葚什么季节成熟| 吃花生米有什么好处| 护理专业主要学什么| 627是什么星座| 颜值控是什么意思| hiv弱阳性是什么意思| 女性手麻是什么原因| 虾黄是虾的什么部位| 1120是什么星座| 一度是什么意思| 刚拔完牙需要注意什么| 做无创需要注意什么| feel什么意思| asic是什么意思| 麝香是什么味道| 梅毒查血查什么项目| 心电图异常q波是什么意思| 心慌是什么原因引起的| 中文是什么意思| 马属相和什么属相最配| 什么人容易得格林巴利| 什么叫钝痛| 动物的尾巴有什么作用| vvs是什么意思| 十八层地狱分别叫什么| 沙参长什么样子图片| 牙刷属于什么垃圾| 入赘是什么意思| pg是什么意思| 砚是什么东西| 又什么又什么的花| 留意是什么意思| 经期可以喝什么| 西安属于什么省| 龙肉指的是什么肉| 肝脾肿大是什么症状| 胸闷气短咳嗽是什么原因引起的| 老人吃什么水果对身体好| 巴洛特利为什么叫巴神| 佰草集属于什么档次| 淡盐水是什么水| 睾丸痒用什么药膏最好| 顾里为什么和席城睡了| 佝偻病是什么病| 乌合之众什么意思| 脾大是什么原因造成的| 腿抽筋是什么问题| 食人鱼的天敌是什么| 红军为什么要长征| 耳聋是什么原因引起的| 肚子疼吃什么药最有效| 怀孕后吃避孕药有什么后果| 脚后跟疼是什么情况| 月经不调是什么原因| 穿什么好呢| 圣旨是什么意思| 早餐吃什么比较好| 以什么之名| 为什么明星都不戴黄金| 氯化钠是什么东西| 黑藻是什么植物| 女人最大的底气是什么| 眩晕症有什么症状| 休克的本质是什么| crt是什么意思| 一什么荷花| 科学家是干什么的| 540是什么意思| 全身酸痛吃什么药| 薤是什么菜图片| 威士忌什么味道| 肠痈是什么意思| 肌肉的作用是什么| 婴儿血小板低是什么原因| energy是什么牌子| 百度

敦煌艺术大展:高品位文化活动提升获得感

PD Note: When you edit this page, you agree to release your contribution under the CC0. See Public Domain Help Pages for more info. PD
百度 行业观察首套房贷利率提高,与二套房贷利率提高形成联动效应,将进一步打消投机为主用户的预期,致二手交易链条断裂。

TemplateStyles enables the complex behavioral and aesthetic styling of templates through the use of referenced external CSS files that are wiki pages themselves. Notably, the ability to create/modify the CSS files is included in the default permissions for autoconfirmed users and so doesn't require involving someone with interface administrator privileges.

How does it work?

edit

Editors can add <templatestyles src="[some page]" /> to a page and the contents of the referenced page will be parsed as CSS, sanitized and loaded on pages where the ?<templatestyles> tag is used (either directly, or transcluded by a template in use on the page).

[some page] must have the sanitized-css (Sanitized CSS) content model, which is the default for subpages in the Template namespace that end with .css. The recommended usage pattern is to store the styles for Template:Foo in a subpage of the template they're most impactful upon, such as Template:Foo/styles.css. If [some page] lacks a namespace prefix, it defaults to the Template namespace. Thus, for example, <templatestyles src="Foo/styles.css" /> will load Template:Foo/styles.css.

The ?<templatestyles> tag should be placed before the content that is styled, ideally at the top of the template or as close to there as possible, to avoid a potential flash of unstyled content if the page becomes initially visible while still only partially rendered.

What problems does it solve?

edit

TemplateStyles allows editors to associate style rules to specific pages, provides the full power of CSS stylesheets while filtering dangerous constructs, and works with preview/debug tools (such as TemplateSandbox ) as expected.

Lowering the access and maintainability barrier will hopefully result in more innovation in the way templates are visually designed, less maintenance overhead, and better adaptability to screen options (especially with mobile devices constituting more than half of Wikipedia pageviews even as of March 2016).

Traditionally, there were two ways to style templates (or any other content) on MediaWiki pages, with neither approach working especially well any of the following:

  • Using inline styles (that is, raw HTML code with added attributes like style="margin: 10px;")
  • Using certain special system messages such as MediaWiki:Common.css

For inline styling

edit
  • There is no separation of content and presentation. In cases where the content does not come from a template (e.g. tables in articles), that will result in article wikitext that's unintelligible for most editors.
  • Since styles are mixed with wikitext, syntax highlighting and other forms of CSS editing support are difficult or impossible.
  • Styles have to be repeated for each HTML element they apply to, which results in lots of copy-pasting and code that is hard to read and maintain.
  • Style attributes are limited to a subset of CSS. Most importantly, @media rules needed for responsive design do not work so it's impossible to make templates that work well over a wide range of screen sizes. Furthermore, inline styles take precedence over CSS stylesheets so user-, skin- or device-specific customizations become more difficult.

For system pages (MediaWiki:*.css)

edit
  • Editing is limited to interface administrators , which is a major barrier to participation.
  • Editing restrictions cannot be lifted as there is no way to limit what CSS rules can be used, and some of them could be abused to track readers' IP addresses or even execute scripts in some older browsers.
  • Changes are impossible to test without saving first. T112474
  • All stylesheets must be loaded on all pages (whether they actually use the page or not), which wastes bandwidth and makes debugging style rules harder.

Is it safe?

edit

Yes! TemplateStyles includes a full-fledged CSS parser that reads, re-serializes and escapes all code and removes CSS rules which it does not recognize. The parser is sufficiently fine-grained to reject remote resources (such as background images) but allow local ones. CSS selectors are rewritten so that they cannot refer to elements outside article content. (Visually modifying areas outside article content by displacing parts of the article, e.g. via absolute positioning, is not prevented at this time. This is no change from the status quo, as such a thing was already possible with wikitext and inline styles.)

Allowed CSS properties and rules

edit

As of 5 March 2025, TemplateStyles accepts no fewer than 331 CSS properties and aliases, including the vast majority of those most often used on the modern internet with official support by one or more major web browser. Beyond simple rules, @media, @page, @supports, @keyframe, @font-face/@font-feature-values at-rules are also supported (with font-face restricted to fonts whose name starts with TemplateStyles, for security reasons).


How can I target mobile/desktop resolutions?

edit

Media queries allow you to target elements at mobile resolution and desktop resolution. Some advise making your styles mobile friendly by default and wrapping desktop styles within the media query. Note, MediaWiki has standardised on 640px and 1120px breakpoints to represent tablet and desktop.

How can I target specific skins?

edit

MediaWiki provides various classes on the html and body elements, including one that indicates which skin is in use. These can be targeted by including a simple selector for the html or body element including the needed classes, followed by a space (or in CSS terms, the descendant combinator).

Generally, this technique should be used for design consistency, rather than targeting mobile and desktop as all skins can be used in both mobile and desktop resolutions. See also #How can I target mobile/desktop resolutions?.

/* Elements with class 'foo' will have red text in all skins. */
.foo { color: red; }

/* Override that element's color to green for the Vector skin only. */
body.skin-vector .foo { color: green; }

/* Add a red border if the browser doesn't have JavaScript enabled. */
html.client-nojs .foo { border: 1px solid red; }

/* Declare that same border as green for the Vector skin. */
html.client-nojs body.skin-vector .foo { border-color: green; }
/* This does not work; the 'body' element must be selected! */
.skin-vector .foo { background: orange; }

/* These do not work, either; the descendant combinator must be used. */
body.skin-vector > .foo { background: orange; }
body.skin-vector ~ .foo { background: orange; }
html.client-nojs > body.skin-vector .foo { background: orange; }

How do I use styles in MediaWiki messages?

edit

To prevent a malicious user from messing with the parts of the document outside the main content area, all CSS rules automatically get prefixed by the mw-parser-output CSS class. If you use a TemplateStyles-based template outside of the content area (e.g. in the sitenotice ), you need to provide that class yourself, by wrapping the template in something like <div class="mw-parser-output"></div>.

In which order do CSS styles override?

edit

Which CSS rule takes effect is controlled by specificity (roughly, the complexity of the selector - e.g. div.foo { margin: 10px } is more specific than .foo { margin: 5px }). In case of equal specificity, CSS styles that come later in the document override earlier styles.

MediaWiki:Common.css, other site scripts, user scripts and gadgets are loaded in the ?<head> section of the page. TemplateStyles stylesheets are loaded in the ?<body>, so they override site/user script and gadget rules with equal specificity, and in the case of two TemplateStyles rules, the second overrides the first. (Note though that TemplateStyles rules are deduplicated: if the same stylesheet is referenced multiple times on the page, it is only inserted the first time.

Note also that "later" has to do with document position, not load order. Gadgets add their CSS after the page has fully loaded, by manipulating the page with JavaScript; some add it on-demand when the user does some action such as clicking a button. Nevertheless, they add it to the head, so equally-specific CSS rules in the body get precedence over it.)

How can Lua modules interact with styles?

edit

TemplateStyles can be called from a Lua module using frame:extensionTag.

Example code is the following:

local p = {};

function p.templateStyle( frame, src )
    return frame:extensionTag( 'templatestyles', '', { src = src } );
end

return p;

What anti-abuse features are provided?

edit

The design choice to store CSS in separate pages was made in part to make integration with the standard anti-abuse toolset easy. TemplateStyles CSS pages have their own content model (sanitized-css) so changes to them can be tracked or controlled with Extension:AbuseFilter , using the new_content_model variable.

CSS inclusion is tracked the same way as template transclusion, so you can see where a stylesheet is used via the "What links here" option, see what stylesheets are used on a page under "Page information" (and possibly on the edit screen, depending on what editor you use), and see what recent changes might be affecting a page using "Related changes".

TemplateStyles also leaves identifying information in the HTML code; to find out where a specific rule comes from, look at the page source, and the enclosing ?<style> tag will have an attribute like data-mw-deduplicate="TemplateStyles:r123456", where 123456 is the revision ID of the stylesheet (viewable with Special:Diff, for example).

How were the decisions around TemplateStyles made?

edit

The idea of including CSS with templates was proposed and accepted in a request for comments. Technical details were pinned down in a second RfC and workflow details were expanded through a user consultation.

Who is working on TemplateStyles?

edit

TemplateStyles was originally a project of the Wikimedia Reading Infrastructure team (preceded by exploratory work Coren did as a volunteer), consisting of Brad Jorsch (developer), Bryan Davis (manager) and Gerg? Tisza (developer) at the time. People and responsibilities have since moved around; see the maintainers page for current ownership.

Where do I report errors / ask for features?

edit

Please file tasks under the TemplateStyles component in Phabricator.

Where can I see it in action?

edit

You can look at some curated examples.

The feature is enabled on all Wikimedia sites.

See also

edit
儿童干咳吃什么药 保释是什么意思 李子有什么功效与作用 浑身痒是什么原因 胸为什么会胀痛
潮吹是什么意思 丙氨酸氨基转移酶是查什么的 乳糖不耐受喝什么奶粉比较好 命卦是什么意思 清鱼是什么鱼
至加秦是什么字 千娇百媚是什么意思 纤维蛋白是什么 脉搏细是什么原因 什么是断掌
蛐蛐进屋有什么预兆 黑便是什么原因 卡马西平片治什么病 手上长红点是什么原因 出汗对身体有什么好处
5月5日什么星座wmyky.com wilson是什么意思hcv8jop3ns0r.cn juicy什么意思hcv9jop8ns1r.cn 湿吻是什么意思hcv8jop9ns7r.cn 膝关节疼痛吃什么药好hcv8jop8ns5r.cn
什么药可以缩阴紧致hcv8jop7ns1r.cn 九月五日是什么节日hcv9jop8ns0r.cn 益安宁丸主治什么病hcv8jop5ns0r.cn 胰岛素是什么hcv7jop9ns4r.cn 丝瓜有什么好处hcv8jop1ns3r.cn
包皮炎挂什么科hcv7jop5ns1r.cn 乳腺癌三期是什么意思hcv9jop3ns8r.cn 鸡皮肤用什么药膏最好520myf.com 羔羊跪乳是什么意思hcv9jop4ns3r.cn 检测怀孕最准确的方法是什么hcv7jop6ns6r.cn
胭脂是什么hcv7jop4ns7r.cn 郑和下西洋是什么朝代wuhaiwuya.com 燊读什么hcv7jop9ns6r.cn 什么心竭什么hcv9jop2ns6r.cn 梵高的星空表达了什么hcv7jop5ns1r.cn
百度