java
java

Reputation: 1165

Set width of table - not afftected

I am trying to set a fixed width to a certain table with the class selector. But its not affected at all. What is missing/wrong with this syntax?

css

.delivoptions_table th {
  table-layout:fixed;
  overflow: hidden;
  width: 200px;
}

the table ..

<div class = "delivoptions_table">
    <table id="deliver_alt_table">

            <tr>
                <td> ... </td>
            </tr>

         ...

    </table>
 </div>

Upvotes: 0

Views: 21

Answers (1)

BenM
BenM

Reputation: 53246

Your CSS selector is targeting all <th> elements within the .delivoptions_table <div>, but you don't have any <th> elements inside. Update your selector to target the <table> itself:

.delivoptions_table table {
    table-layout:fixed;
    overflow: hidden;
    width: 200px;
}

Upvotes: 2

Related Questions