0

I'm trying to style a table in CSS. However i can't use a class properly, even if I used div or a. Whatever I tried with the class it didn't worked, simply the hover isn't working. what you suggest me to do?

<html>
<style>
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    border: 1px solid #ddd;

  }
  
  th, td {
    text-align: center;
    padding: 8px;
    border-right: 3px solid red;
  }
  .ellenon {
      background-color: red;
      border-radius: 10px;
  }
  .ellenon :hover {
      background-color: green;
      border-radius: 30px;
  }

</style>
 <body>
        <p>Table</p>   
        <table style="width:100%" >
            <tr>
              <th >Condition</th>
              <th>Value</th>
            </tr>
            <tr>
             <td class="ellenon" style="text-align:center"> Humidity</td>
              <td style="text-align:center">15%</td>
            </tr>
            <tr>
              <td style="text-align:center">Temprature</td>
              <td style="text-align:center">25 °C</td>
            </tr>
          </table>
    </body>
</html>
Ellenon
  • 27
  • 3

1 Answers1

0

you had an extra space in here .ellenon :hover changing it to .ellenon:hover fixed the issue

<html>
<style>
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    border: 1px solid #ddd;

  }
  
  th, td {
    text-align: center;
    padding: 8px;
    border-right: 3px solid red;
  }
  .ellenon {
      background-color: red;
      border-radius: 10px;
  }
  .ellenon:hover { 
      background-color: green;
      border-radius: 30px;
  }

</style>
 <body>
        <p>Table</p>   
        <table style="width:100%" >
            <tr>
              <th >Condition</th>
              <th>Value</th>
            </tr>
            <tr>
             <td class="ellenon" style="text-align:center"> Humidity</td>
              <td style="text-align:center">15%</td>
            </tr>
            <tr>
              <td style="text-align:center">Temprature</td>
              <td style="text-align:center">25 °C</td>
            </tr>
          </table>
    </body>
</html>
Sarkar
  • 1,225
  • 7
  • 21