2012-06-14 17:18:32 +00:00
title: StyleBlockWikiText
2013-08-25 20:41:00 +00:00
tags: wikitextrule
2012-06-14 17:18:32 +00:00
2013-02-06 11:27:41 +00:00
This syntax enables you to assign arbitrary styles and classes to generated elements. For example:
2012-06-14 17:18:32 +00:00
2013-02-04 10:26:26 +00:00
```
2012-06-14 18:03:51 +00:00
@@color:#f00;
@@text-decoration:underline;
2013-02-06 11:27:41 +00:00
@@.myClass
2012-06-14 17:18:32 +00:00
This is in red!
@@
2013-02-04 10:26:26 +00:00
```
2012-06-14 17:18:32 +00:00
Generates the results:
2012-06-14 18:03:51 +00:00
@@color:#f00;
@@text-decoration:underline;
2013-02-06 11:27:41 +00:00
@@.myClass
2012-06-14 17:18:32 +00:00
This is in red!
@@
The HTML looks like this:
2013-02-04 10:26:26 +00:00
```
2013-02-06 11:27:41 +00:00
<p class="myClass" style="color:rgb(255, 0, 0); text-decoration:underline;">This is in red!</p>
```
Note that classes and styles can be mixed subject to the rule that styles must precede classes. For example
```
@@.myFirstClass.mySecondClass
@@width:100px;.myThirdClass
This is a paragraph
@@
2013-02-04 10:26:26 +00:00
```
2012-06-14 17:49:51 +00:00
Note that the style block doesn't generate any HTML elements itself, but instead causes the styles to be applied to all of the elements contained within the style block. This means that you can assign styles to elements generated from WikiText. For example, here is a list with some additional styles applied:
2013-02-04 10:26:26 +00:00
```
2012-06-14 18:03:51 +00:00
@@background-color:#00f;
2012-06-14 17:49:51 +00:00
* First item
* Second item
* Third item
@@
2013-02-04 10:26:26 +00:00
```
2012-06-14 17:49:51 +00:00
The generated HTML is:
2013-02-04 10:26:26 +00:00
```
<ul style="background-color: #00f;">
2012-06-14 17:49:51 +00:00
<li>First item</li>
<li>Second item</li>
<li>Third item</li></ul>
2013-02-04 10:26:26 +00:00
```
2012-06-14 17:49:51 +00:00