I have a Rails app where I'm using Bootstrap and jquery dataTables.
The dataTable is wider than the Bootstrap span set in the parent div. I would like the table to stay within the width of the span.
This is the first 2 lines of the view page:
<div class="span12">
<table class="display table dataTable table-striped table-bordered table-condensed" id="dataTable1" >
Thanks for the help!
I ended up using this:
<div class="span12" style="width: 1100px;">
As per request by #Reddirt to promote my comment to an answer...
Have you tried to just put a width on the table? eg:
<table style="width:600px"
Related
I have below view which generates PDF invoice using MvcRazorToPdf library
<table border="0">
<tr>
<td>
<h1>Company Name </h1>
</td>
<td>
<div style="text-align:right;margin-right:0px;">
Invoice
</div>
</td>
</tr>
</table>
<hr/>
<div>
#Model.InvoiceNum
</div>
Above code generates below view in pdf
But how much ever I style the above div within td for invoice, I am not able to move the Invoice text to the right side of the pdf. I've tried adding link to bootstrap.css which doesn't work either. Anyone have any solution for this? Has anyone worked on styling the pdf with MvcRazorToPdf librabry?
Your text alignment is being respected, its just that by default, you table and its cells will be collapsed to fit the content (easy to check by using your browser tools to inspect the elements).
Give your table (or its cells a width), for example
<table style="width:100%;">
However, using <table> elements is not good practice (refer Why not use tables for layout in HTML? and Why Tables Are Bad (For Layout*) Compared to Semantic HTML + CSS.). Instead you can use floats or relative/absolute positioning, for example
<div style="position:relative;">
<h1>Company Name</h1>
<span style="position:absolute;right:0;bottom:0">Invoice</span>
</div>
or
<div>
<h1 style="display:inline-block">Company Name</h1>
<div style="float:right;margin-top:40px;">Invoice</div>
</div>
I'm having an issue with the Bootstrap 3 table-responsive on iOS 7 (iPad4 on safari).
When I load the webpage with the table it can only show 70% of the table and the rest is hidden to the right:
But the issue is when i scroll to the right the background color of the table is lost and the background of the body is shown:
I've simplified the table as much as possible to weed out anything silly i missed with no luck. Here is how the body is defined (i removed the table info because it's being created by some ng-repeats and aren't helpful):
<body style="background-color: #3E3E40;">
<div class="container">
<div class="table-responsive">
<table class="table" style="background-color: #E0E0E3;">
....
</table>
</div>
</div> <!-- /container -->
</body>
Any information or suggestions on how to fix this issue will be greatly appreciated!!!
How does this work for you? http://jsfiddle.net/panchroma/qYY2y/
HTML is unchanged, I'm applying the table background color to table-responsive div that wraps your table
.table-responsive{
background-color:#fff;
}
Hope this helps!
EDIT
A variation for #rapcal with a drop shadow on the responsive table
http://jsfiddle.net/panchroma/16yt4vnq/
Applying a drop shadow to the table directly won't work because of how the native bootstrap stying handles overflows on the table-responsive div. But if you wrap everything in another div you have more freedom
HTML
<div class="wrapper"> <!-- apply drop shadow to this div -->
<div class="table-responsive">
<table class="table"> ... </table>
</div>
</div>
If I add the following slide into the default presentation provided by reveal.js, then the table is not centred.
<section>
<p>This is centred</p>
<table>
<tr>
<td>This</td>
<td>is</td>
<td>not</td>
</tr>
</table>
</section>
I can fix it by adding in padding, but this then becomes dependent on the screen size, and I am worried that when I go to present the screen will be a different size. There must be a better way?
According to this and my testing, if you add the reveal class to your table, the newest reveal.js should center it.
<section>
<p>This is centred</p>
<table class="reveal">
<tr>
<td>This</td>
<td>is</td>
<td>not</td>
</tr>
</table>
</section>
I am using asp.net mvc 4 and jqGrid. Is it possible to add more than 1 jqGrid to the same page? if so, could you tell me how? I have two jgGrid, both in the same page, but one appears in one tab and the another in another tab. I have a jquery ui tab. My problem is that only one is shown, the another not. Any ideas what's wrong?
<div id="jqGrid" class="jqGrid">
#Html.Partial("../Grids/_ComponentGrid")
</div>
<div id="jqGridCapsules" class="jqGrid">
#Html.Partial("../Grids/_CapsuleGrid")
</div>
Partial views:
../Grids/_ComponentGrid:
<table id="_componentGrid" cellpadding="0" cellspacing="0">
</table>
<div id="_componentPager" style="text-align: center;">
</div>
../Grids/_CapsuleGrid:
<table id="_capsuleGrid" cellpadding="0" cellspacing="0">
</table>
<div id="_capsulePager" style="text-align: center;">
</div>
I have debugged it with Internet explorer and as I can see, it seems like jqGrid is being applied correctly for first (I post main div, within them there are others divs nested):
<div class="jqGrid" id="jqGrid">
<div class="ui-jqgrid ui-widget ui-widget-content ui-corner-all" id="gbox__componentGrid" style="width: 790px;" dir="ltr">
<div class="ui-widget-overlay jqgrid-overlay" id="lui__componentGrid"/>
<div class="loading ui-state-default ui-state-active" id="load__componentGrid" style="display: block;">
<div class="ui-jqgrid-view" id="gview__componentGrid" style="width: 790px;">
<div class="ui-jqgrid-resize-mark" id="rs_m_componentGrid">
<div class="ui-state-default ui-jqgrid-pager ui-corner-bottom" id="_componentPager" style="width: 790px; text-align: center;" dir="ltr">
</div>
However, for second is not being applied as generated code is:
<div class="jqGrid" id="jqGridCapsules">
<table id="_capsuleGrid" cellspacing="0" cellpadding="0">
<div id="_capsulePager" style="text-align: center;">
as you can see for second, the code generated is completely different from the first. It should be the same as first. So it seems like jqGrid style is not being applied to the second one, Why? What's happening? any ideas, please?
As you can see here: http://jsfiddle.net/kralco626/3BYDu/
The icon does not show up when you use display:inline
How do I get around this?
Useui-icon, before of the ui-icon-ICON and use the CSS display:inline-block should work properly
<span class="ui-icon ui-icon-home" style="display: inline-block"/>
<table>
<thead>
<th>
<div style="float:left">My Header</div>
<div style="float:left" class="ui-icon ui-icon-triangle-1-n"></div>
</th>
</thead>
</table>
Edit for formatting.
Well, I guess you could try inline-block instead of inline.