Line border color

I want to set the <tr> border to yellow. I can set the border of <td> , but I can not figure out how to set the border of the string <tr> . How to do it?

Thanks.

+4
source share
5 answers

No, I can’t, ime, although the css spec ( http://www.w3.org/TR/CSS2/box.html#border-properties ) explicitly says that borders and border color can be applied to "all elements". Although this may be because <table> may not fall under the box model; I am not sure about that.

In any case, this is counter-intuitive, crazy, seeming, swollen on the pita page.

There should be better solutions than bordering on each cell of the table, which I do.

- pete

+3
source

This example works fine on IE8, Chrome 9, and Firefox 3.6, so I really don’t see what the problem is.

HTML used in the example:

 <table> <tr> <td>AAA</td> <td class="middle">BBB</td> <td>CCC</td> </tr> </table> 

CSS:

 .middle { border: 2px solid blue; } tr { border: 2px solid red; } 

Result:
enter image description here

+8
source

It works , but by specification.
The problem is that borders are collapsing, and you did not expect this.

And by specification, the border for td tends to dominate the border for tr :
http://www.w3.org/TR/CSS2/tables.html#border-conflict-resolution

+3
source

Write a CSS rule for a tr element? Something like tr {border: ...} Have you tried this and it doesn't work? First check your HTML code with the W3C markup validator and fix errors if indicated.

-1
source

I did this without css.

<TR BORDERCOLOR="RED" BGCOLOR ="PINK"> output

works in IE but not firefox, chrome or even edge.

-2
source

Source: https://habr.com/ru/post/1343516/


All Articles