Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HTML
<table>
<tr>
<td > Hi i am in first row first column </td>
</tr>
</table>


then i created .less file

CSS
body{
    background :red;
}

td{
background-color :red;
}
}


But its not changing the column color.can anyone help
Posted

1 solution

Hello,

Just Check the nth Child in odd and even rowwise
C#
<style>
tr:nth-child(odd) {
    background: #ff0000;
}
tr:nth-child(even) {
   background: #dddd21;
}
</style>

XML
<table>
<tr>
<td > Hi i am in first row first column </td>
</tr>
<tr>
<td > Hi i am in second row first column </td>
</tr>
</table>
 
Share this answer
 
v5
Comments
Member 11491784 14-Jul-15 3:39am    
Do you have any idea, how can i achieve this in Visual studio. I am refrencing .less file from html but its saying .less file not found
Anil Vaghasiya 14-Jul-15 5:18am    
Ya, Install the Compiler tools such as "Koala" that is converted .less to css file.

If you want to convert .less to css without 3rd party tools Just You have to Install "WebToolsExtensionsVS.msi" it will converted .less to css after that add the css link in head section.

Thank You.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900