I was trying to set calendar in table structure but I don't know how to set caption at the top of the table.
Also I can't change the table structure. I want it to look like below:
.calendar_wrap table {
width: 100%;
}
.calendar_wrap #wp-calendar thead th {
font-weight: 500;
color: #45515a;
font-size: 20px;
line-height: 28px;
}
.calendar_wrap #wp-calendar tbody td {
font-weight: 400;
font-size: 24px;
line-height: 36px;
color: #5b666f;
}
.calendar_wrap #wp-calendar tfoot td a {
color: #3d9596;
font-weight: 500;
margin-top: 10px;
display: inline-block;
font-size: 22px;
line-height: 32px;
}
.calendar_wrap #wp-calendar tbody td a {
color: #EF9950;
}
.calender-box {
padding: 15px;
border: 1px solid #d4d9dd;
border-radius: 8px;
}
caption {
font-size: 30px;
line-height: 36px;
color: #007ab0;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<section class="calendar_wrap mt-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-4 mt-4 calender-box">
<table id="wp-calendar">
<caption>February 2019</caption>
<thead>
<tr>
<th scope="col" title="Monday">M</th>
<th scope="col" title="Tuesday">T</th>
<th scope="col" title="Wednesday">W</th>
<th scope="col" title="Thursday">T</th>
<th scope="col" title="Friday">F</th>
<th scope="col" title="Saturday">S</th>
<th scope="col" title="Sunday">S</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3" id="prev">« Oct</td>
<td class="pad"> </td>
<td colspan="3" id="next" class="pad"> </td>
</tr>
</tfoot>
<tbody>
<tr>
<td colspan="4" class="pad"> </td><td>1</td><td>2</td><td>3</td>
</tr>
<tr>
<td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td>
</tr>
<tr>
<td>11</td><td>12</td><td>13</td><td>14</td><td>15</td><td>16</td><td>17</td>
</tr>
<tr>
<td>18</td><td>19</td><td>20</td><td>21</td><td>22</td><td>23</td><td>24</td>
</tr>
<tr>
<td id="today">25</td><td>26</td><td>27</td><td>28</td>
<td class="pad" colspan="3"> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
Add caption-side: top - for style specificity either make the selector #wp-calendar caption or add !important to the style - see demo below:
.calendar_wrap table {
width: 100%;
}
.calendar_wrap #wp-calendar thead th {
font-weight: 500;
color: #45515a;
font-size: 20px;
line-height: 28px;
}
.calendar_wrap #wp-calendar tbody td {
font-weight: 400;
font-size: 24px;
line-height: 36px;
color: #5b666f;
}
.calendar_wrap #wp-calendar tfoot td a {
color: #3d9596;
font-weight: 500;
margin-top: 10px;
display: inline-block;
font-size: 22px;
line-height: 32px;
}
.calendar_wrap #wp-calendar tbody td a {
color: #EF9950;
}
.calender-box {
padding: 15px;
border: 1px solid #d4d9dd;
border-radius: 8px;
}
caption {
font-size: 30px;
line-height: 36px;
color: #007ab0;
}
#wp-calendar caption { /* ADDED */
caption-side: top;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<section class="calendar_wrap mt-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-4 mt-4 calender-box">
<table id="wp-calendar">
<caption>February 2019</caption>
<thead>
<tr>
<th scope="col" title="Monday">M</th>
<th scope="col" title="Tuesday">T</th>
<th scope="col" title="Wednesday">W</th>
<th scope="col" title="Thursday">T</th>
<th scope="col" title="Friday">F</th>
<th scope="col" title="Saturday">S</th>
<th scope="col" title="Sunday">S</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="3" id="prev">« Oct</td>
<td class="pad"> </td>
<td colspan="3" id="next" class="pad"> </td>
</tr>
</tfoot>
<tbody>
<tr>
<td colspan="4" class="pad"> </td><td>1</td><td>2</td><td>3</td>
</tr>
<tr>
<td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td>
</tr>
<tr>
<td>11</td><td>12</td><td>13</td><td>14</td><td>15</td><td>16</td><td>17</td>
</tr>
<tr>
<td>18</td><td>19</td><td>20</td><td>21</td><td>22</td><td>23</td><td>24</td>
</tr>
<tr>
<td id="today">25</td><td>26</td><td>27</td><td>28</td>
<td class="pad" colspan="3"> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
Related
I created a card using the bootstrap. Within that card I intend to insert a table with data.
My problem is that when reducing the screen (check responsiveness), the data in the table comes out of the card.
How can I solve this problem of mine, can someone help me?
Thanks
DEMO
.HTML
<div style="width:40%">
<div class="card">
<div class="card-header header">
<h1>My Table</h1>
</div>
<table class="card-table table-borderless myTable" style="overflow-y: auto; overflow-x: auto;">
<thead>
<tr>
<th scope="col tableTitles">Title</th>
<th scope="col tableTitles">Name</th>
<th scope="col tableTitles">ID</th>
<th scope="col tableTitles">Street</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let pr of Data; let a = index;" class="tableColor">
<td class="tableTitles">
{{pr.title}}
</td>
<td class="tableTitles">
{{pr.name}}
</td>
<td class="tableTitles">
{{pr.id}}
</td>
<td class="tableTitles">
{{pr.street}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
.CS
.card {
margin-top: 16px;
margin-left: 16px;
height: 400px;
margin-right: 16px;
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 20px #BCBCCB47;
border-radius: 8px;
opacity: 1;
border: 2px solid red;
}
.header {
width: 100%;
height: 40px;
background: #ECF2F9 0% 0% no-repeat padding-box;
border-radius: 8px 8px 0px 0px;
}
.header h1 {
text-align: center;
font-family: 'Noto Sans', sans-serif;
font-size: 14px;
letter-spacing: 0;
color: #4D4F5C;
}
Problem
Add
word-break: break-all;
to <table> in CSS and it will break words if necessary.
.card {
margin-top: 16px;
margin-left: 16px;
height: 400px;
margin-right: 16px;
background: #FFFFFF 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 20px #BCBCCB47;
border-radius: 8px;
opacity: 1;
border: 2px solid red;
}
.header {
width: 100%;
height: 40px;
background: #ECF2F9 0% 0% no-repeat padding-box;
border-radius: 8px 8px 0px 0px;
}
.header h1 {
text-align: center;
font-family: 'Noto Sans', sans-serif;
font-size: 14px;
letter-spacing: 0;
color: #4D4F5C;
}
.card-table {
word-break: break-all;
}
<div _ngcontent-qii-c0="" style="width:20%">
<div _ngcontent-qii-c0="" class="card">
<div _ngcontent-qii-c0="" class="card-header header">
<h1 _ngcontent-qii-c0="">My Table</h1>
</div>
<table _ngcontent-qii-c0="" class="card-table table-borderless myTable" style="overflow-y: auto; overflow-x: auto;">
<thead _ngcontent-qii-c0="">
<tr _ngcontent-qii-c0="">
<th _ngcontent-qii-c0="" scope="col tableTitles">Title</th>
<th _ngcontent-qii-c0="" scope="col tableTitles">Name</th>
<th _ngcontent-qii-c0="" scope="col tableTitles">ID</th>
<th _ngcontent-qii-c0="" scope="col tableTitles">Street</th>
</tr>
</thead>
<tbody _ngcontent-qii-c0="">
<tr _ngcontent-qii-c0="" class="tableColor">
<td _ngcontent-qii-c0="" class="tableTitles"> asdasdad </td>
<td _ngcontent-qii-c0="" class="tableTitles"> asdasdas assd </td>
<td _ngcontent-qii-c0="" class="tableTitles"> 123123 </td>
<td _ngcontent-qii-c0="" class="tableTitles"> asdsadasdcas asdsad </td>
</tr>
</tbody>
</table>
</div>
</div>
I squeezed it a bit to show the result and used generated HTML from your demo, cause it's a CSS problem, so we don't need Angular here.
How to make the horizontal scroll bar only affects the gray columns in the following illustration.
html,
body {
background: #ccc;
font-family: Arial, sans-serif
}
#table {
background: white;
margin: 100px auto;
width: 400px;
overflow: auto;
text-align: center;
}
#inner-table {
border-collapse: collapse;
border-radius: 3px;
overflow: hidden
}
td,
th {
padding: 5px 10px;
}
th {
border-bottom: 1px solid #B8C2CC
}
.sticky {
background-color: #1C3D5A;
color: #dae1e7;
}
.scroll {
background-color: #B8C2CC;
color: #22292f
}
<div id="table">
<table id="inner-table">
<thead>
<tr>
<th class="sticky">sticky</th>
<th class="sticky">sticky</th>
<th class="scroll">scroll</th>
<th class="scroll">scroll</th>
<th class="scroll">scroll</th>
<th class="scroll">scroll</th>
<th class="scroll">scroll</th>
<th class="scroll">scroll</th>
<th class="sticky">sticky</th>
<th class="sticky">sticky</th>
</tr>
</thead>
<tbody>
<tr>
<td class="sticky">1</td>
<td class="sticky">2</td>
<td class="scroll">3</td>
<td class="scroll">4</td>
<td class="scroll">5</td>
<td class="scroll">6</td>
<td class="scroll">7</td>
<td class="scroll">8</td>
<td class="sticky">9</td>
<td class="sticky">10</td>
</tr>
<tr>
<td class="sticky">11</td>
<td class="sticky">12</td>
<td class="scroll">13</td>
<td class="scroll">14</td>
<td class="scroll">15</td>
<td class="scroll">16</td>
<td class="scroll">17</td>
<td class="scroll">18</td>
<td class="sticky">19</td>
<td class="sticky">20</td>
</tr>
</tbody>
</table>
</div>
This was rather more difficult to put together than I anticipated - and even now, I am wondering if there isn't a much simpler approach.
The approach below utilises:
an outer container which contains two position: absolute tables
a fixed-width inner container - using margins for positioning inside the outer container - with a scrollbar, which allows you to see the oversized table it contains
Working Example:
html,
body {
background: #ccc;
font-family: Arial, sans-serif
}
.outer-container {
position: relative;
background-color: white;
margin: 40px auto;
width: 400px;
overflow: hidden;
text-align: center;
}
.outer-container,
.inner-container {
height: 125px;
}
table {
height: 108px;
}
.inner-container table {
border-radius: 3px;
}
td, th {
padding: 5px 10px;
}
th {
border-bottom: 1px solid #B8C2CC
}
.fixed-table th,
.fixed-table td {
background-color: #1C3D5A;
color: #dae1e7;
}
.inner-container {
margin: 0 130px;
max-width: 612px;
overflow: auto;
}
.inner-container > table {
background-color: #B8C2CC;
color: #22292f
}
.outer-container > table {
position: absolute;
top: 0;
border-collapse: collapse;
}
.outer-container > table:nth-of-type(1) {
left: 0;
}
.outer-container > table:nth-of-type(2) {
right: 0;
}
<div class="outer-container">
<table class="fixed-table">
<thead>
<tr>
<th>sticky</th>
<th>sticky</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>11</td>
<td>12</td>
</tr>
</tbody>
</table>
<div class="inner-container">
<table>
<thead>
<tr>
<th>scroll</th>
<th>scroll</th>
<th>scroll</th>
<th>scroll</th>
<th>scroll</th>
<th>scroll</th>
</tr>
</thead>
<tbody>
<tr>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
</tr>
<tr>
<td>13</td>
<td>14</td>
<td>15</td>
<td>16</td>
<td>17</td>
<td>18</td>
</tr>
</tbody>
</table>
</div>
<table class="fixed-table">
<thead>
<tr>
<th>sticky</th>
<th>sticky</th>
</tr>
</thead>
<tbody>
<tr>
<td>9</td>
<td>10</td>
</tr>
<tr>
<td>19</td>
<td>20</td>
</tr>
</tbody>
</table>
</div>
CSS3 should do the job.
table {
position: relative;
padding-left: (width-of-your-td-elements);
}
table td:first-of-type {
position: absolute;
left: 0;
}
Sources
How can I center two tables side by side?
I am centering the single table, But I could not center two tables,There is a simple way but i could not, How can i do with css?
My codes are as follows:
#import url(http://fonts.googleapis.com/css?family=Roboto:400,500,700,300,100);
body {
background-color: #FFFFFF;
font-family: "Roboto", helvetica, arial, sans-serif;
font-size: 16px;
font-weight: 400;
text-rendering: optimizeLegibility;
}
/*** Table Styles **/
.table-fill {
background: white;
border-radius: 3px;
border-collapse: collapse;
height: 120px;
max-width: 400px;
padding: 5px;
width: 100%;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
animation: float 5s infinite;
}
<table class="table-fill" style="" border="1">
<thead>
<tr>
<th class="text-left">1</th>
<th class="text-left">2</th>
<th class="text-left">3</th>
</tr>
</thead>
<tbody class="table-hover">
<tr>
<td class="text-right">Val1</td>
<td class="text-center">a</td>
<td class="text-left">%</td>
</tr>
</tbody>
</table>
<table class="table-fill" style="" border="1">
<thead>
<tr>
<th class="text-left">1</th>
<th class="text-left">2</th>
<th class="text-left">3</th>
</tr>
</thead>
<tbody class="table-hover">
<tr>
<td class="text-center">AÇILAN SANDIK</td>
<td class="text-left">1</td>
<td class="text-left">1</td>
</tr>
<tr>
<td class="text-center">KALAN SANDIK</td>
<td class="text-left">1</td>
<td class="text-left">1</td>
</tr>
</tbody>
</table>
By adding 'display:inline-table;' css to your .table-fill css class, may solve your problem
#import url(http://fonts.googleapis.com/css?family=Roboto:400,500,700,300,100);
body {
background-color: #FFFFFF;
font-family: "Roboto", helvetica, arial, sans-serif;
font-size: 16px;
font-weight: 400;
text-rendering: optimizeLegibility;
}
/*** Table Styles **/
.table-fill {
background: white;
border-radius: 3px;
border-collapse: collapse;
height: 120px;
max-width: 400px;
padding: 5px;
width: 100%;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
animation: float 5s infinite;
display:inline-table;
}
<table class="table-fill" style="" border="1">
<thead>
<tr>
<th class="text-left">1</th>
<th class="text-left">2</th>
<th class="text-left">3</th>
</tr>
</thead>
<tbody class="table-hover">
<tr>
<td class="text-right">Val1</td>
<td class="text-center">a</td>
<td class="text-left">%</td>
</tr>
</tbody>
</table>
<table class="table-fill" style="" border="1">
<thead>
<tr>
<th class="text-left">1</th>
<th class="text-left">2</th>
<th class="text-left">3</th>
</tr>
</thead>
<tbody class="table-hover">
<tr>
<td class="text-center">AÇILAN SANDIK</td>
<td class="text-left">1</td>
<td class="text-left">1</td>
</tr>
<tr>
<td class="text-center">KALAN SANDIK</td>
<td class="text-left">1</td>
<td class="text-left">1</td>
</tr>
</tbody>
</table>
added text-align:center; to body or a parent of the tables and display:inline-table; to the .table-fill check it on full page view.
#import url(http://fonts.googleapis.com/css?family=Roboto:400,500,700,300,100);
body {
background-color: #FFFFFF;
font-family: "Roboto", helvetica, arial, sans-serif;
font-size: 16px;
font-weight: 400;
text-rendering: optimizeLegibility;
text-align:center;
}
/*** Table Styles **/
.table-fill {
background: white;
border-radius: 3px;
border-collapse: collapse;
height: 120px;
max-width: 400px;
padding: 5px;
width: 100%;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
animation: float 5s infinite;
display: inline-table;
}
<table class="table-fill" style="" border="1">
<thead>
<tr>
<th class="text-left">1</th>
<th class="text-left">2</th>
<th class="text-left">3</th>
</tr>
</thead>
<tbody class="table-hover">
<tr>
<td class="text-right">Val1</td>
<td class="text-center">a</td>
<td class="text-left">%</td>
</tr>
</tbody>
</table>
<table class="table-fill" style="" border="1">
<thead>
<tr>
<th class="text-left">1</th>
<th class="text-left">2</th>
<th class="text-left">3</th>
</tr>
</thead>
<tbody class="table-hover">
<tr>
<td class="text-center">AÇILAN SANDIK</td>
<td class="text-left">1</td>
<td class="text-left">1</td>
</tr>
<tr>
<td class="text-center">KALAN SANDIK</td>
<td class="text-left">1</td>
<td class="text-left">1</td>
</tr>
</tbody>
</table>
Can someone look this issue?
The scroll bar is showing for one table where as it's not showing for another table which is made of same CSS and present HTML file.
For Top Table Scrollbar is not showing but for bottom table it's showing
HTML table not showing Scroll
<div class="wrapper">
<table class="professional">
<tbody>
<tr>
<th class="tableheader" ng-show="accountInfo.accountId > 0">Account Number</th>
<th class="tableheader" ng-show="accountInfo.accountId > 0" >First Name</th>
<th class="tableheader" ng-show="accountInfo.accountId > 0">Last Name</th>
<th class="tableheader" ng-show="accountInfo.accountId > 0">Status</th>
<th class="tableheader" ng-show="accountInfo.accountId > 0">Services</th>
<th class="tableheader" ng-show="accountInfo.accountId > 0">Suspend Status</th>
<th class="tableheader" ng-show="accountInfo.accountId > 0">Phone Number</th>
<th class="tableheader" ng-show="accountInfo.accountId > 0">Activation Code</th>
<th class="tableheader" ng-show="accountInfo.accountId > 0">SSO ID</th>
</tr>
<tr>
<td class="features" >{{accountInfo.accountId}}</td>
<td class="features" >{{accountInfo.firstName}}</td>
<td class="features" >{{accountInfo.lastName}}</td>
<td class="features" >{{accountInfo.status}}</td>
<td class="features" >{{accountInfo.group}}</td>
<td class="features" >{{accountInfo.suspended}}</td>
<td class="features" >{{accountInfo.homePhone}}</td>
<td class="features" >{{accountInfo.activationCode}}</td>
<td class="features" >{{accountInfo.guid}}</td>
</tr>
</tbody>
</table>
</div>
HTML Table showing Scroll
<div class="wrapper">
<table class="professional">
<tbody>
<tr>
<th class="tableheader" ng-repeat="list in cellularIPAddressValue">{{list.deviceType}}
</th>
</tr>
<tr>
<td class="features" ng-repeat="list in cellularIPAddressValue">{{list.instanceId}}
</td>
</tr>
<tr>
<td class="features" ng-repeat="list in cellularIPAddressValue">{{list.firmwareVersion}}
</td>
</tr>
<tr>
<td class="features" ng-repeat="list in cellularIPAddressValue">{{list.manufacturer}}
</td>
</tr>
<tr>
<td class="features" ng-repeat="list in cellularIPAddressValue">{{list.model}}
</td>
</tr>
<tr>
<td class="features" ng-repeat="list in cellularIPAddressValue">
{{list.troubles[0].description}}
<p ng-show="list.troubles[0]">Failure On {{list.troubles[0].date}}
</p>
</td>
</tr>
</tbody>
</table>
</div>
CSS:
.wrapper {
overflow: scroll;
width: 1350px;
white-space: nowrap;
padding-bottom: 10px;
padding-top: 10px;
}
.professional .title {
padding-top: 10px;
background: #2980b9;
}
.professional .tableheader, .professional .pt-footer {
background: #2980b9;
}
.professional .tableheader:after {
border-top-color: #2980b9;
}
.professional .pt-footer:after {
border-top-color: #FFFFFF;
}
I have got the solution for the above problem.
Corrected by modifying the CSS as below
So I have added white-space : nowrap hence the content looks good now with scroll bar with same data without shrinking
.wrapper {
overflow : auto;
width: 1350px;
white-space: nowrap;
padding-bottom : 10px;
padding-top : 10px;
}
.th {
text-align: center;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
width : auto;
height : word-spacing;
white-space: nowrap;
}
.td {
white-space: nowrap;
border-style: solid;
border-right-color: #ff0000;
}
Are the tables on the same page? If yes, change the table class to something else:
<table class="professional"> for table 1
<table class="professional2"> for table 2
And CSS for table 1:
.professional .title {
padding-top: 10px;
background: #2980b9;
}
.professional .tableheader, .professional .pt-footer {
background: #2980b9;
}
.professional .tableheader:after {
border-top-color: #2980b9;
}
.professional .pt-footer:after {
border-top-color: #FFFFFF;
}
CSS for table 2:
.professional2 .title {
padding-top: 10px;
background: #2980b9;
}
.professional2 .tableheader, .professional .pt-footer {
background: #2980b9;
}
.professional2 .tableheader:after {
border-top-color: #2980b9;
}
.professional2 .pt-footer:after {
border-top-color: #FFFFFF;
}
I have the problem that the scroll bar appears disabled. What I want to achieve is static table header (that is why I used two tables) and a scrollable table body.
HTML:
<div id="segment-content">
<div class="table-header">
<table>
<thead>
<tr class="font-readable">
<th class="hashtag" align="center">#</th>
<th class="in">In</th>
<th class="out">Out</th>
<th class="duration">Duration</th>
<th class="filename">Filename</th>
<th class="unset">Unset</th>
<th class="preview">Preview</th>
<th class="public">Public</th>
</tr>
</thead>
</table>
</div>
<div class="table-body">
<table>
<tbody>
<tr class="font-readable">
<td class="hashtag">1</td>
<td class="in">10-10-2015 11:11:00</td>
<td class="out">10-10-2015 11:11:00</td>
<td class="duration">1800 seg</td>
<td class="filename">10-10-2015-11-11-00-10-10-2015-11-1200.mp4</td> <td class="unset">Unset</td>
<td class="preview">Preview</td>
<td class="public">Public</td>
</tr>
<tr class="font-readable">
<td class="hashtag">2</td>
<td class="in">10-10-2015 11:11:00</td>
<td class="out">10-10-2015 11:11:00</td>
<td class="duration">1800 seg</td>
<td class="filename">10-10-2015-11-11-00-10-10-2015-11-12-00.mp4</td>
<td class="unset">Unset</td>
<td class="preview">Preview</td>
<td class="public">Public</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
CSS
#segment-content {
/*margin-top: 455px;*/
margin-top: 470px;
margin-left: 65px;
margin-right: 65px;
background: #1F1F1F;
}
.table-body {
overflow-y: scroll;
height: 100%;
}
table {
width: 100%;
}
.font-readable {
font-family: Tahoma, Geneva, sans-serif;
font-size: 11px;
font-weight: bold;
text-align: center;
}
.hashtag {
width: 20px;
}
.in, .out {
width: 200px;
}
.duration {
width: 100px;
}
.filename {
width: 400px;
}
how can i fix this?