How to make responsive table
Basically
A responsive table is simply a 100% width table.
You can just set up your table with this CSS:
.table {
width: 100%;
}
<table class="table" border="1">
<thead>
<tr>
<th colspan="2">Table head</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</tbody>
</table>
how to make responsive table with bootstrap
I've had a look into your second example.
the troubling part is obviously your title bar, whose elements are inside the class ritekhela-fancy-title-two
And you have a wrapping div around this class, named row
, this div needs to get set to adapt its width to the nested content.
Since fit-content is experimental and not available at all browsers, you'll need set width to auto and make it behave as an inline block
Then you must set the width of your ritekhela-fancy-title-two
class to auto
and remove the float:left, or set it to float:none
and it will neither overflow on larger screens or not expand to the width of table on smaller screens.
that's it, check the fiddle with above changes implemented
these are the two css styles which were changed/added:
.row {
width: fit-content; /*works with Chrome, but not with FF*/
width: auto;
display: inline-block;
}
.ritekhela-fancy-title-two {
float: none;
width: auto;
padding: 12px 20px 12px 60px;
border-top: 7px solid;
background: url(/css/images/transparent-pattren.png);
position: relative;
margin-top: 30px;
background-color: #6c757d;
}
edit: as above changes also affect the lower title bars, which is easy to correct, adding some height to the second row:
.ec-nextmatch {
border: 1px solid #f3f3f3;
border-top: none;
background-color: #fff;
margin-bottom: 60px;
float:none;
height:90px;
width:auto;
}
also remove .ec-nextmatch from this css, so it looks now:
.ec-team-matches, .ec-match-countdown, .ec-match-countdown .countdown-row, .ec-ticket-button {
float: left;
width: 100%;
}
Make table responsive on mobile devices using HTML/CSS
Try using Bootstrap for responsive tables.
The .table-responsive
class creates a responsive table. The table will then scroll horizontally on small devices (under 768 px). When viewing on anything larger than 768 px wide.
Use .table-responsive{-sm|-md|-lg|-xl}
as needed to create responsive tables up to a particular breakpoint. From that breakpoint and up, the table will behave normally and not scroll horizontally.
How to make table responsive
Use this html & css code for make rsponsive table
Check the Snippets is below .
- Use this css with media query max-width:760px or any width
.responsive-table { margin:0px auto; width:500px; border: 1px solid #efebeb; } .responsive-table img{height:100px; } .responsive-table th { display: none; } .responsive-table td { display: block; border-top: 1px solid #ddd; } .responsive-table td:first-child{border:none;} .responsive-table td:first-child { padding-top: .5em; } .responsive-table td:last-child { padding-bottom: .5em; } .responsive-table td:before { content: attr(data-th) ": "; display:block; font-weight:bold; }
<table class="responsive-table"> <tbody> <tr> <th> Room </th> <th> Guest </th> <th> Description </th> <th> Rate </th> <th> Book </th> </tr> <tr> <td data-th="Room"> <img src="http://i45.tinypic.com/t9ffkm.jpg" alt="Sample Image" /> </td> <td data-th="Guest"> 2 adult </td> <td data-th="Description"> Room Only
</td> <td data-th="Rate"> USD 200
</td> <td data-th="Book"> <button type="submit"> Book</button> </td> </tr> </tbody></table>
How to create a responsive table using C?
This is not the complete solution, but you may be able to work out exactly what you want/need based on the ideas here. (The key ingredient is that log10()
, a math library function) will tell how much horizontal space will be needed. Feed it the largest value in each of the 3 numbers columns and you determine the widths needed from that.
#include <stdio.h>
#include <math.h> // for log10()
int demo( int m0, int m1 ) {
char buf[ 100 ]; // adequate
int wid0 = (int)( log10( m0 ) + 1);
int wid1 = (int)( log10( m1 ) + 1);
int widR = (int)( log10( m0 * m1 ) + 1);
int need = 0;
need++; // left 'box'
need++; // space
need += wid0; // first number
need += strlen( " x " ); // mult
need += wid1; // second number
need += strlen( " | " ); // middle box
need += widR; // result
need++; // space
need++; // right 'box'
memset( buf, '\0', sizeof buf ); // start null
memset( buf, '-', need );
puts( buf );
printf( "| %*d x %*d | %*d |\n\n", wid0, m0, wid1, m1, widR, m0 * m1 );
return 0;
}
int main() {
demo( 24, 25 );
demo( 15, 456 );
return 0;
}
Output:
-----------------
| 24 x 25 | 600 |
-------------------
| 15 x 456 | 6840 |
Related Topics
Overflow:Hidden Not Working as Expected in Google Chrome
How to Have an Image Placeholder in Angularjs
Resource Interpreted as Script But Transferred with Mime Type Text/X-C++
Checking Hardware Acceleration Availability? (Testing Available)
Cannot View the Source Image File on a Website
CSS 2, Precedence of Stylesheets Imported Using Link Element
CSS Calc and Min-Height Can Not Team Up Properly
Do CSS Variables Work Differently in Microsoft Edge
How to Avoid Double Border from the Multiple <Li>
Css: How to Combine Multiple Stylesheets into One
Does Chrome Have Issue with Setting A:Visited CSS Properties
Remove Conflicting Styling - Bootstrap & Google Custom Search
Blinking Loading Text in R Shiny
Inline CSS Background-Size Cover
Send Variable to Withstyles in Material Ui