]> sipb.mit.edu Git - ikiwiki.git/blob - doc/forum/formating:_how_to_align_text_to_the_right.mdwn
(no commit message)
[ikiwiki.git] / doc / forum / formating:_how_to_align_text_to_the_right.mdwn
1 As in title, how to align text to the right?
2
3 > Add to your local.css a class that aligns text to the right:
4
5         .alignright { text-align: right; }
6
7 > And then you just just use `<span class="alignright">` around
8 > other html.
9
10 > You can refine that, and allow right-aligning markdowned text
11 > by using the [[ikiwiki/directive/template]]
12 > directive, with a template that contains the html. The 
13 > [[templates/note]] template does something similar. --[[Joey]]
14
15 >> Thanks!
16
17 -----
18 <div class="notebox">
19 [[!format mdwn """
20 This is my text with [a markdown link](#).
21
22 Here's a *second* paragraph.
23 """]]
24 </div>
25
26 > There is more than one way to do it. If [[plugins/format]] is enabled, then this:
27 >
28 >     <div class="notebox">
29 >     \[[!format mdwn """
30 >     This is my text with [a markdown link](#).
31 >
32 >     Here's a *second* paragraph.
33 >     """]]
34 >     </div>
35 >
36 > is rendered like the box in this page.
37 >
38 > (I'm using the `notebox` class used by the `note` template here, but you could
39 > use any class.) --[[smcv]]
40
41 -----
42 > Doing this myself and noted that [[ikiwiki/markdown]] down does not allow the enclosure of block level elements directly; and thus we cannot switch the `span` suggested above for `div` in changing block level elements (not if you wish to include markdown, anyway).  For example, I want to create a paragraph (with markdown text) which is right aligned, and so add the following
43
44 >>     <span class="right_align">
45 >>     This is my text with [a markdown link](/)
46 >>     </span>
47
48 > The *correct* thing to do here is create a template (as indicated above) **but** a workaround I found useful was to over-ride the `inline` nature of the `span` element, as follows
49
50 >>     .align_right { display: block ; text-align: right ; }
51
52 > you may also like to remove the padding and margins since they will be provided by the enclosing block. -- fergus