user3079275 user3079275 - 3 months ago 15
CSS Question

border-bottom style having no effect

I have this snippet of html which displays a grid like structure. It looks as I want it for the most part except that I want to have a dotted underline for the last three rows. I tried to have a bottom border using the following styling:

style="border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">

However it has no effect at all even when I tweak the width etc., what am I missing?

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="AnimalGrid" style="border:solid; border-width:2px; border-color:lightgray; padding-left:12px;padding-top:8px;margin:10px">
<table style="width:100%">
<tr>
<td style="font-family:Calibri; font-size:large; color:midnightblue; text-align:left"><b>RESULT DETAILS</b></td>
</tr>
<tr>
<td style="width:25%; font-size:large; padding-left: 2px"><i>Animal<sup>1</sup></i></td>
<td style="width:25%; font-size:large; padding-left: 6px"><i>Animal</i></td>
<td style="width:25%; font-size:large; padding-left: 6px"><i>Speed<sup>2</sup></i></td>
<td style="width:25%; font-size:large; padding-left: 6px"><i>Type<sup>3</sup></i></td>
</tr>
<tr style="border-bottom-style:dotted; border-bottom-color: black; border-bottom-width:2px">
<td style="width:25%; font-size:large; padding-left: 6px">Cheetah</td>
<td style="width:25%; font-size:large; padding-left: 6px">Tiger</td>
<td style="width:25%; font-size:large; padding-left: 6px">60mph</td>
<td style="width:25%; font-size:large; padding-left: 6px">Carnivore</td>
</tr>

<tr style="border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">
<td style="width:25%; font-size:large; padding-left: 6px">Lion</td>
<td style="width:25%; font-size:large; padding-left: 6px">Zebra</td>
<td style="width:25%; font-size:large; padding-left: 6px">40mph</td>
<td style="width:25%; font-size:large; padding-left: 6px">Mixed</td>
</tr>

<tr style="border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">
<td style="width:25%; font-size:large; padding-left: 6px">Horse</td>
<td style="width:25%; font-size:large; padding-left: 6px">Cow</td>
<td style="width:25%; font-size:large; padding-left: 6px">10mph</td>
<td style="width:25%; font-size:large; padding-left: 6px">Herbivore</td>
</tr>
</table>
</div>
</body>
</html>

Answer

Like this?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
  <div id="AnimalGrid" style="border:solid; border-width:2px; border-color:lightgray; padding-left:12px;padding-top:8px;margin:10px">
    <table style="width:100%">
      <tr>
        <td style="font-family:Calibri; font-size:large; color:midnightblue; text-align:left"><b>RESULT DETAILS</b></td>
      </tr>
      <thead>
         <th style="width:25%; font-size:large; padding-left: 2px"><i>Animal<sup>1</sup></i></th>
         <th style="width:25%; font-size:large; padding-left: 6px"><i>Animal</i></th>
         <th style="width:25%; font-size:large; padding-left: 6px"><i>Speed<sup>2</sup></i></th>
         <th style="width:25%; font-size:large; padding-left: 6px"><i>Type<sup>3</sup></i></th>
      </thead>
      <tr>
         <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Cheetah</td>
         <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Tiger</td>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">60mph</td>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Carnivore</td>
    </tr>

    <tr>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Lion</td>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Zebra</td>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">40mph</td>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Mixed</td>
    </tr>

    <tr>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Horse</td>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Cow</td>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">10mph</td>
        <td style="width:25%; font-size:large; padding-left: 6px; border-bottom:dotted; border-bottom-color: black; border-bottom-width:2px">Herbivore</td>
    </tr>
    </table>
    </div>
  </body>
</html>
Comments