开发者

wikia template style attribute

开发者 https://www.devze.com 2023-01-18 23:15 出处:网络
I have made some templates on wikia.com, which contain only CSS code (key:value开发者_如何学运维;).

I have made some templates on wikia.com, which contain only CSS code (key:value开发者_如何学运维;).

My problem is having another template use these style templates in a style attribute tag.

style="{{MyTemplateStyle}}"

This code does not evaluate as expected. The CSS code is outputted before the element and the style attribute is not included inside the element.

Am I trying something not possible for a wiki ?

I merely want to be able to change styling on certain templates in one place, like regular HTML & CSS pages.


CSS styling specified from the style="" attribute always takes priority over any other css, even if you use !important in a CSS specification.

Therefore any edits you make to your CSS on Wikia will not ever override the CSS specified inside an attribute.


Kim, you were right to switch to classes instead of embedding in-line styles via templates.

The very idea of using templates suggest that this was going to be re-used in more than one place, applying styles to a group or, in fact, a class of elements.

This approach is much simpler to read and maintain (as you only have one, central place to edit), and also, if done right, will enable you to seamlessly change the colour scheme via Special:ThemeDesigner.

0

精彩评论

暂无评论...
验证码 换一张
取 消