Unable to change column size in fixed layout table

Shiroslullaby

I've got an html page that has several div containers, one of which has a table. I'm using an external style sheet, and no matter what I try, I can't get the first column to resize.
I've set "table-layout: fixed;" and attempted to use "width" and "max-width" on the column, but nothing I do will let me re-size the column.
Hoping someone can point out why its not possible to resize this column?
Is some other attribute stopping this resize from working? Does one of the div containers cause a problem here?

https://jsfiddle.net/Shiroslullaby/ahstbwd5/2/

I have some extra CSS but that does things like highliting on hover, I'm leaving everything intact in the small chance that its causing an issue here.

HTML:

<html>
<head>
    <title>Customers</title>
    <link rel="stylesheet" href="test2.css">


</head>
<body>
    <div id="header"></div>
    <div id="container">
    <div class="left">

    <table class="customertable">
<thead>    
<tr>
<th class="shortcolumn">id</th><th>businessName</th><th>contactName</th>  
 <th>contactEmail</th>
</tr>
</thead>
<tbody> 
<tr>
<td>1</td><td>Microsoft</td><td>Bill Gates</td><td>[email protected]</td>
</tr>
<tr>
<td>2</td><td>Amazon</td><td>Jeff Bezos</td><td>[email protected]</td>
</tr>
</tbody>
</table>
    </div>
    <div class="right"><div id="fixedright"></div></div>
    </div>
    <div id="footer"></div>
 </body>
</html> 

CSS:

.customertable {
table-layout: fixed;
overflow-x:auto;
width: 100%;
word-wrap: break-word;
 }

.shortcolumn {
 max-width: 10%;
}


#container {
position: relative;
width: 100%
}

div {
 border-radius: 5px;
}

#header {
 height: 50px;
 background-color: #F38630;
 margin-bottom: 10px;
}

.left {

 width: 75%;
 background-color: #A7DBD8;
 margin-bottom: 10px;

}

.right {
 height: 100%;
 width: 25%;
 background-color: #E0E4CC;
 position: absolute;
 top: 0px;
 right: 0px;
 bottom: 0px;
 margin-bottom: 10px;

 }

#footer {
  height: 50px;
  background-color: #69D2E7;
  clear: both;
}

#fixedright {
 height: 50px;
 width: calc(25% - 6px);
 background-color: #FFFFFF;
 position: fixed;
 margin: 1px 1px 1px 1px;
}

thead {
background: #231E5E;
color: #FFF;
}

tbody tr:nth-child(odd) {
background: #E9F5D7;

}

tbody tr:hover {

background-color: #86C133;
}
scooterlord

Here you are... fixed!

https://jsfiddle.net/ahstbwd5/3/

Table cells don't accept max-width, only width...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Minimum column width using fixed table layout

From Dev

TD column width value not working with fixed table-layout

From Dev

Table column fixed size is not giving the desired result, why not?

From Dev

Bootstrap fixed column size

From Dev

Bootstrap fixed size column

From Dev

Bootstrap fixed column size

From Dev

Two-column layout in Bootstrap (max-width and fixed size columns)

From Dev

Something like "table-layout:fixed" but only for one table-column

From Dev

How is table layout fixed rendered?

From Dev

Reading a file with fixed size column

From Dev

Two column layout, fixed right column

From Dev

X-axis is fixed size in matplotlib (unable to change with set_xlim)

From Dev

how to make pretty photo layout fixed size?

From Dev

Fixed table layout not filling specified table width

From Dev

Html table with fixed header and fixed column both

From Dev

3 column layout, same height, middle column full size. How to do it without "table-cell"

From Dev

two column table layout

From Dev

android: screen size layout change

From Dev

Div Table with fixed right column

From Dev

Html table fixed column width

From Dev

Table scroll with fixed first column

From Dev

CSS fixed left column in table

From Dev

PocketGrid: Grid Layout with fixed width navigation column

From Dev

Fixed toggleable footer in a 3 column layout

From Dev

Change layout size depends on Screen size

From Dev

table-layout fixed with mixed px and %

From Dev

table-layout:fixed behaves odd on iPhone

From Dev

3 column layout (fixed, fluid, fixed) with minimum width

From Dev

How to create 3-column layout (fixed, fixed, fluid)