Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
43
rated 0 times [  45] [ 2]  / answers: 1 / hits: 20168  / 10 Years ago, tue, march 18, 2014, 12:00:00

I want to build a table with a title bar. The title bar has to have the title on the left side and some buttons (that I´ll add Javascript support) on right side. I´m not succeeding.



JS Fiddle link



Code:



<div class=table-responsive small>
<table class=table table-striped table-bordered table-hover table-condensed>
<caption style=border: inherit; background-color: lightgrey;>
<span class=align-left><strong>Monthly Savings Report</strong></span>
<button type=button id=printBtn class=btn btn-default btn-sm title=Print>
<span class=glyphicon glyphicon-print></span>
</button>
</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
</div>


Questions:



a) How Can I align the title text 'Monthly Savings Report' to left and the Print button to right ?



b) Is there a way to style it better (using Bootstrap default style classes instead of style=border: inherit; background-color: lightgrey;?


More From » jquery

 Answers
7

To align the Print button to the right use this



.table caption button{
float:right;
}


To style the caption remove the inline styling and add the below in your stylesheet



.table caption{
border: inherit;
background-color: lightgrey;
}

[#71918] Monday, March 17, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lara

Total Points: 462
Total Questions: 100
Total Answers: 102

Location: Jersey
Member since Mon, Jun 14, 2021
3 Years ago
lara questions
;