I want scrollable in <thread> in table on top header - css

<div className="table-responsive">
<table className="table table-sm">
<thead>
<tr className="table-active">
<th>name</th>
<th>nickname</th>
<th>age</th>
<th>gender</th>
<th>height</th>
<th>weight</th>
</tr>
</thead>
<tbody id="table-body">
<tr>
<td>Alex</td>
<td>Alex</td>
<td>24</td>
<td>Male</td>
<td>1.70</td>
<td>60</td>
<tr>
</tbody>
</table>
</div>
i want css style scrollable in header table and under table and don't want fixed head table on top
so i was searching all day in google I can't found result i want please tell or help me.

Related

Bootstrap4: Table using the whole width but still using table-responsive

Would it be possible to use table-responsive that only use the minimal column width based on the length of the data in the column, and also having the thead using all the canvas width.
Example: (the last column that has no content would use the remaining space on the right)
If you add a table-responsive class to your table, it will occupy 100% of it's parent's width and will space the columns equally... this is shown in the top table in the code snippet below
But we can do what you're looking for:
want all the columns to use minimal width
last empty column to occupy the remaining width.
check the bottom table in the code snippet below
th {
background: lightgray
}
.myTableOne td {
white-space: nowrap
}
.myTableOne th:last-of-type {
width: 100%;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<div class="container-fluid">
<h4>Table with table-responsive class</h4> <br/>
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>City</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Anna</td>
<td>Pitt</td>
<td>35</td>
<td>New York</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<hr/>
<h4>Table for your requirements </h4>
<br/>
<div class="myTableOne">
<table class=" table-bordered">
<thead>
<tr>
<th>#</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>City</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Anna</td>
<td>Pitt</td>
<td>35</td>
<td>New York</td>
<td></td>
</tr>
</tbody>
</table>
</div>

Setting the width of the cells in html5

I'm trying to attribute an width for cells but it doesn't work. I used CSS to make it, since width is not supported in HTML5. In my problem I have a table with headers and inside that table I have another table with a scroll to show the results, I need to order the cell results by the headers attributing the same width as headers. Can someone help me?
Here's the fiddle . Thank you!
Here's what i've tried:
<table class="two">
<thead>
<tr>
<th style="width:150px">Tipo de Anúncio</th>
<th style="width:150px">Tipo de Imóvel</th>
<th style="width:150px">Localização</th>
<th style="width:150px">Mediador</th>
<th style="width:150px">Preço</th>
<th style="width:150px">Área</th>
</tr>
</thead>
<tbody class="scroll">
<tr>
<td colspan="2">
<div class="scroll">
<table>
<tr>
<td style="width:150px">January</td>
<td style="width:150px">$100</td>
<td style="width:150px">February</td>
<td style="width:150px">$80</td>
<td style="width:150px">February</td>
<td style="width:150px">$80</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
<td>February</td>
<td>$80</td>
<td>February</td>
<td>$80</td>
</tr>
<tr>
<td>January</td>
<td>$100</td>
<td>February</td>
<td>$80</td>
<td>February</td>
<td>$80</td>
</tr>
You have several problem in your layout but the main is not the width but the colspan : (thw width work right)
your th don't wrap all the column. If ypu have six column you need a colspan = 6
<tbody class="scroll">
<tr>
<td colspan="6">
I have touched only few element but ypou can see a preliminary result in this jsfiddle

Align text at each end of a column - Bootstrap

I have a responsive table where the end column shows money figures. Currently it looks like this:
But I want it to do this:
There may not be any data so the £ sign will be replace with N/A which should also be pulled to the right of the column.
The data is fetched from MySQL but here is a simplified snippet of my code:
<table id="mytable" class="table table-bordred table-striped">
<thead>
<th>Reference</th>
<th>Client</th>
<th>Description</th>
<th>Money</th>
</thead>
<tbody>
<tr>
<td>#1234</td>
<td>Josh Blease</td>
<td>Needs a new filter fixing</td>
<td class='money'>
<div class='text-right'>Budget: £123,456</div>
<div class='text-right'>Value: £200,000</div>
<div class='text-right'>Spent: N/A</div>
</td>
</tr>
</tbody>
Divs are useful but Ii don't think that be the best solution for this case maybe you need to use better the table properties
http://www.usabilidad.tv/tutoriales_html/colspan_y_rowspan.asp
<table id="mytable" class="table table-bordred table-striped">
<thead>
<th>Reference</th>
<th>Client</th>
<th>Description</th>
<th colspan="2">Money</th>
</thead>
<tbody>
<tr>
<td rowspan="4">#1234</td>
<td rowspan="4">Josh Blease</td>
<td rowspan="4">Needs a new filter fixing</td>
</tr>
<tr>
<td>Budget</td>
<td>£123,456</td>
</tr>
<tr>
<td>Value</td>
<td>£200,000</td>
</tr>
<tr>
<td>Spent</td>
<td>N/A</td>
</tr>
</tbody>
</table>
<table id="mytable" class="table table-bordred table-striped">
<thead>
<th>Reference</th>
<th>Client</th>
<th>Description</th>
<th>Money</th>
</thead>
<tbody>
<tr>
<td>#1234</td>
<td>Josh Blease</td>
<td>Needs a new filter fixing</td>
<td class='money'>
<div class='text-right'><span>Budget:</span> £123,456</div>
<div class='text-right'><span>Value:</span> £200,000</div>
<div class='text-right'><span>Spent:</span> N/A</div>
</td>
</tr>
</tbody>
and
#mytable tbody tr td .text-right span{
min-width:200px;
max-width:300px;
display: inline-block;
}
Spans need to be set as inline-block otherwise the width properties won't take hold as they are by default inline only elements.
Setting the min and max width will force the span container to not go below or above a certain point, meaning that your other text will be forced to stay to the left of the (example) 200px mark even if your initial text (as in spent) only ends up being (again, example) 80px

JqMobile table style broken?

I have problem with my table JqMobile style is not working when I uploaded to the server I want datat be horizontal not broken.
http://jsfiddle.net/Tbu9U/
html
<table data-role="table" id="productOrders" data-mode="reflow" class="ui-table ui-table-reflow">
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Price</th>
<th>Qty.</th>
<th>Ext.</th>
</tr>
</thead>
<tbody>
<tr>
<td><b class="ui-table-cell-label">Code</b></td>
<td><b class="ui-table-cell-label">Name</b></td>
<td><b class="ui-table-cell-label">Price</b></td>
<td><b class="ui-table-cell-label">Qty.</b></td>
<td><b class="ui-table-cell-label">Ext.</b></td>
</tr>
<tr>
<td>uj7uu</td>
<td>games</td>
<td class="dollars">$70</td>
<td>3</td>
<td>$210</td>
</tr>
</tbody>
</table>
Here is your fiddle updated: http://jsfiddle.net/ezanker/Tbu9U/1/
The only change was on the table markup, remove the class ui-table-reflow and instead add ui-responsive:
<table data-role="table" id="productOrders" data-mode="reflow" class="ui-table ui-responsive">

Nested table not displaying in IE7

I have a nested table inside a table which is nestedTable and it does not show up in IE7 even though it exists in the html and display is not none. Below is my html which seems to be valid and working in Firefox, Chrome and IE8:
<table id="myTable">
<thead> ... </thead>
<tbody class="myTbody1">
<tr class="details">
<td>
<table id="nestedTable">
<thead>
<tr>
<th> Col1 </th>
<th> Col2 </th>
</tr>
</thead>
<tbody class="head">
<tr class="nestedRow">
<td> Data</td>
<td> Data</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
<tbody class="myTbody2">..</tbody>
<tbody class="myTbody3">..</tbody>
</table>

Resources