I need help with colspan colour...... | Sololearn: Learn to code for FREE!

+3

I need help with colspan colour......

#Attributes

4/13/2021 11:20:04 AM

Lil MAYHEM99

7 Answers

New Answer

+4

To colour table cell with colspan attribute, use selector td[colspan] https://code.sololearn.com/WP6YOTuiipPQ/?ref=app

+7

<body> <table style="border-collapse:collapse;"> <thead> <tr> <th colspan="2">Famous Monsters by Birth Year</th> </tr> <tr style="border-bottom:1px solid black;"> <th style="padding:5px;"><em>Famous Monster</em></th> <th style="padding:5px;border-left:1px solid black;"><em>Birth Year</em></th> </tr> </thead> <tbody> <tr> <td style="padding:5px;">King Kong</td> <td style="padding:5px;border-left:1px solid black;">1933</td> </tr> <tr> <td style="padding:5p

+5

colspan doesn't have much to do with colour. If you have a td or th, colspan will let you span multiple columns. colpsan is more related to size of your td or th element than it is to any colour. Regarding colour, the following CSS properties can be used depending on what you want the colour applied to: background-color border-color color Note that colspan is an HTML attribute but those colour properties are from CSS.

+1

Ok...got it thanks

+1

Thanks Calvin

+1

<html> <head> <title> salary_table</title> <style> td[colspan] { background:blue; } </style> </head> <body> ............................. .... ............ ........... ....... ................. .......... ....... ....... </body> </html> [If you do colspan color, you will use "style" tag in the "head" tag. ]

-2

https://code.sololearn.com/W3A8a21A25A1/?ref=app