Topic on Project:Support desk

How to change background color in table?

9
Summary by Jonathan3

Using CSS

89.204.154.18 (talkcontribs)

When I make the heading of a class wikitable, I can use a "!" or a "|" to start a line.

When I use "!", then the background color of the line is as I want it, but all text in it will be written in bold.

When I start a line instead with "|", then I don't know how to make the same background color as above, but the text won't get bold.

How can I make a special background color in any line of class wikitable, without getting the line text bold?

Leranjun (talkcontribs)
89.204.154.18 (talkcontribs)

Thanks, I see. When I wirte

style="style="background-color:#5dbcd2;"

it will take the color I want. When I write it in the beginning of the table, the whole table takes the color. When I write it for a cell, it is for a cell.

But how can I change the background for a whole line? It would be useful.

Jonathan3 (talkcontribs)

Try this:

{|
!heading1
!heading2
|-style="background-color:red"
|cell1
|cell2
|-
|cell3
|cell4
|}
Polyphon522 (talkcontribs)

Thanks. Works. Next question.

I want my background color be the same as the standard color here in the back of the text "Shopping List"

Help:Tables#HTML colspan and rowspan


I tried already with this, but the colors were very different:

https://imagecolorpicker.com/

It says the color code is #5dbcd2 but when I use this color code, it looks very different.

79.249.156.201 (talkcontribs)

Maybe you can press F12 in your browser, then CTRL+F, enter "<th>", click on the row that contains it, and look on the right bottom corner of the screen, where the CSS rule list is usually located.


A colour code should be listed there.

Polyphon522 (talkcontribs)

Thank you all, I found out. The color I need is #e9e9e9.


Last question.

When I start a line in class="wikitable" with an attention mark, like for instance

!cell 1||cell 2

then the background color of this line becomes automatically #e9e9e9, as I want it to. The problem is, that all text in this line becomes Bold. I don't want that.


Is there a way to use !cell 1|cell 2 (with attention mark), without making the text Bold?

Jonathan3 (talkcontribs)

To do it for an individual table/cell, try this:

{|class="wikitable"
!style="font-weight: normal"|heading1
!heading2
|-style="background-color:red"
|cell1
|cell2
|-
|cell3
|cell4
|}
heading1 heading2
cell1 cell2
cell3 cell4
Polyphon522 (talkcontribs)

Solved!