Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set background color for specific cell in markdown table

Tags:

markdown

I have a markdown table as below:

| 1 | 2 | 3 | |---|---|---| | 4 | 5 | 6 | | 7 | 8 | 9 | 

I wish to set background color to red for a specific cell, e.g. cell 8. I found some forum discussed to use HTML syntax to set font color but not found anyone can set the whole cell background color to red.

like image 529
lucky1928 Avatar asked Oct 04 '14 21:10

lucky1928


People also ask

Can we change the background color of a single cell in a table?

Let's see how to do it. Just click on the 'BACKGROUND' button (1) from the header and then select the cell (2). From the left-hand side, select a color from the 'Selected Cell Background' (3). Then just click on 'Save Table' to save the changes.

How do you add a background color to a table cell?

Cell background colors are set by applying the bgcolor attribute to a <tr> tag (to color the row) or to a <td> tag (to color the cell). Cell colors override row colors which, in turn, override table background colors.

How can you specify background color in a table?

The HTML <table> bgcolor Attribute is use to specify the background color of a table. Attribute Values: color_name: It sets the text color by using the color name. For example “red”.

How do you add a background color in markdown?

Markdown doesn't support color but you can inline HTML inside Markdown, e.g.: <span style="color:blue">some *blue* text</span>. As the original/official syntax rules state (emphasis added): Markdown's syntax is intended for one purpose: to be used as a format for writing for the web.


1 Answers

The background-color is a part of the style. Markdown is only for content and structure.

But you can use css selectors

  • if you can use css3: td:nth-child(n)
  • with css2: td + td and overwrite it again td + td + td

Both versions with your example

like image 177
klml Avatar answered Sep 30 '22 23:09

klml