2

I have the CSS below:

table.Table12 { border:1px solid blue; }
table.Table12 td { border:1px solid blue;   width:200px;}
table.Table12 a:link{   font-weight: bold;}

and the html code below:

<table class="Table12" align="right">
<tr><td><a href="http://www.example.com/test1.php">test1</a></td>
<td><a href="http://www.example.com/test2.php">test2</a></td></tr>
<tr><td><a href="http://www.example.com/test3.php">test3</a></td>  
<td><a href="http://www.example.com/test4.php">test4</a></td></tr>
</table>

All work fine and I set all table to bold font; I just need to change the font of "test3" to normal font in CSS; Is this possible??

esqew
  • 42,425
  • 27
  • 92
  • 132
Abbas1999
  • 395
  • 1
  • 9
  • 27

2 Answers2

2

try this in css:

table.Table12 td:nth-child(3) { font-weight: normal; }

forget it... didnt take in account the last line of your css code. this one works fine:

table.Table12 tr:nth-child(2) td:nth-child(2) a { font-weight: normal; }

more details about nth-child syntax you can find here: How can I get the second child using CSS?

Community
  • 1
  • 1
Nik Terentyev
  • 2,270
  • 3
  • 16
  • 23
2

Nik's answer is right, you don't need to add that in the HTML, instead, you add it to the CSS. Should be added to the end. Like so:

table.Table12 { border:1px solid blue; }
table.Table12 td { border:1px solid blue;   width:200px;}
table.Table12 a:link{   font-weight: bold;}
/*Solution*/
table.Table12 td:nth-child(2) { font-weight: normal; }

That will work right away.

You can also add a class to it and you can recycle it for later use:

.normal-font{font-weight: normal}

And then in your html:

<table class="Table12" align="right">
<tr><td><a href="http://www.example.com/test1.php">test1</a></td>
<td><a href="http://www.example.com/test2.php">test2</a></td></tr>
<tr><td><a href="http://www.example.com/test3.php" class="normal-font">test3</a></td>  
<td><a href="http://www.example.com/test4.php">test4</a></td></tr>
</table>
gmslzr
  • 1,211
  • 1
  • 10
  • 15
  • Yeah, it started counting from 0 rather than 1, I'll edit mine as well for future reference. Happy coding! – gmslzr Aug 27 '14 at 03:49