Home > OS >  How to center a select box in a cell table using HTML?
How to center a select box in a cell table using HTML?

Time:05-21

This may seem silly, but I'm a beginner here and I can't wrap my head around this one:

enter image description here Appreciate any help.

CodePudding user response:

Assuming you are using bootstrap

Change this:

          <td >
          <select  name="D1" style="border-radius: 0.2rem">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA 058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5 76PVCmYl" crossorigin="anonymous"></script>

<table  id="dtable" style="font-size:0.9em">
  <thead style="white-space: nowrap">
    <tr>
      <th style="width: 17%" >Link To File</th>
      <th style="width: 18%" >Approval Status</th>
    </thead>
    <tbody>
      <tr>
        <td  style="word-wrap: break-word;min-width: 160px;max-width: 160px;text-align:center">2</td>
        <td >
          <select  name="D1" style="border-radius: 0.2rem">
            <option value="empty"></option>
            <option value="approved">Approved</option>
            <option value="dicsuss">Discuss</option>
            <option value="cancelled">Cancelled</option>
           </select>
         </td>
      </tr>
   </tbody>
  </table>

  • Related