How do I format an additional markdown table?

I would like to format a table using markdown extra / html. I would like every other line to have a gray background for readability. Also I would like to set the width of the table. To accomplish the second part, I tried this:

<div style="width:300px">

header 1 | header 2 | header 3
-------- | -------- | --------
row 1    | a        | b
row 2    | c        | d       
row 3    | e        | f        

</div>

      

It didn't work. Any suggestions? Thank.

+3


source to share


2 answers


Try using a CSS3 selector for every other line

tr:nth-child(even) {
    background: #ccc;
}​

      



http://jsfiddle.net/6GNCu/

+3


source


I suggest you convert the markup text to HTML, then you apply the css style to the table.

Warning: Markdown syntax does not support tables. You should use a markdown fork that supports additional formatting.



Check out this link

+1


source







All Articles