The problem: post-local CSS
In a recent post, I wanted to add a zebra table ([1],[2])
via the CSS3 tr:nth-child selectors, see
StackOverflow. But the default Octopress markdown drove me
crazy by wrapping everything in <p></p> which killed my
<style> attempts. A quick glance at the
markdown syntax doc suggested I could use <div> to
get around this.
An example
It is useful to define the style locally since a global definition
may not fit all circumstances. In the style below, we define a the
table class ztab1 along with a few other style elements to
dress up the table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
The result
Using the ztab1 table class defined above allows us to
input raw HTML table to produce
| Counter | Animal | Collective Name |
|---|---|---|
| 1 | apes | shrewdness |
| 2 | bees | grist |
| 3 | mules | rake |
| 4 | owls | parliament |
The first column entries are centered by
1
| |
Conclusion
using a <div> tag wrapper prevents the default Octopress
markdown from eating <style> definitions. However a
better solution would be to change the markdown parser, as suggested by
Chico and Aral Balkan.