How can I make a span display inline with a bootstrap responsive table? Currently the span displays on a new line. I'd like the span to be to the right of the table, vertically centered with the table header.
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Sibling(s)</h3></div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>Gender</th>
<th>Name</th>
<th>Birthdate</th>
<th>School</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<select class="form-control" name="sibling-gender1" id="sibling-gender1">
<option></option>
<option>M</option>
<option>F</option>
</select>
</td>
<td>
<input class="form-control" name="sibiling-name1" id="sibiling-name1" style="width: 100%;"/>
</td>
<td>
<input class="form-control" name="sibling-birthdate1" id="sibling-birthdate1" placeholder="MM-DD-YYYY"
style="width: 100%;"/>
</td>
<td>
<input class="form-control" name="sibling-school1" id="sibling-school1" style="width: 100%;"/>
</td>
<td>
<select class="form-control" name="sibling-grade1" id="sibling-grade1">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
<span class="glyphicon glyphicon-plus"></span>
<!-- end .form-group -->
</div>
<!-- end .panel-body -->
</div>
<!-- end .panel -->
You could change the display property of the .table-responsive/span elements to table-cell. Just give .table-responsive a width of 100% in order to fill the remaining space. Additionally, you might also need to add padding to the span element.
EXAMPLE HERE
.table-responsive {
display:table-cell;
width:100%;
}
.table-responsive + .glyphicon.glyphicon-plus {
display:table-cell;
padding-left:10px;
}
If you want the span element to be aligned in the middle, all you would have to do is add vertical-align:middle to the element.
EXAMPLE HERE
.table-responsive + .glyphicon.glyphicon-plus {
display:table-cell;
padding-left:10px;
vertical-align:middle;
}
It's worth noting that this CSS assumes that the element are adjacent siblings. If they aren't, you would need to change the selectors.
A Bootstrap way could be to make the .panel-body a .row too and its children (.table-responsive, .glyphicon) become columns:
<div class="panel-body row">
<div class="col-xs-11 table-responsive "></div>
<span class="col-xs-1 glyphicon glyphicon-plus"></span>
</div>
The vertical center of the table header cannot be determined through CSS (as it is just one part of the left columns height), but you can adjust the top-paddings of the table header cells and the icon.
Related
I have a form and all inputs are set inside table td, I use text input and bootstrap-select in table row.
All inputs are displayed properly with normal resolution in system.
The display size of text inputs gets reduce when I view that in lower resolution or zoom but bootstrap select does not reduce beyond title text or option text and remains the same.
Also table row width remains same, i.e it tries to fit into screen width instead of expanding with scroll beyond screen width.
I want text input not to reduce display size.
following is my code please help on fixing this.
<div class="span6">
<table id="target-tables"
class="table table-responsive table-striped table-bordered table-hover no-margin no-border">
<thead>
<tr>
<th class="no-border" >Title1</th>
<th class="no-border" >Title2</th>
<th class="no-border" >Title3</th>
<th class="no-border" >Title4</th>
<th class="no-border" >Title5</th>
<th class="no-border" >Title6</th>
<th class="no-border" >Title7</th>
<th class="no-border" >Title8</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="col-xs-12 nopadding">
<select class="selectpicker form-element" title='Select a database' >
<option value=".....">......</option>
</select>
</div>
</td>
<td>
<div class="col-xs-12 nopadding">
<input type="text" class="form-element form-control input-md"/>
</div>
</td>
<td>
<div class="col-xs-12 nopadding">
<select class="selectpicker form-element" multiple title="........." >
<option value="......">.....</option>
</select>
</div>
</td>
<td>
<div class="col-xs-12 nopadding">
<input type="text" class="form-element form-control input-md" />
</div>
</td>
<td>
<div class="col-xs-12 nopadding">
<input type="text" class="form-element form-control input-md" />
</div>
</td>
<td>
<div class="col-xs-12 nopadding">
<input type="text" class="form-element form-control input-md" />
</div>
</td>
<td>
<div class="col-xs-12 nopadding">
<select class="selectpicker form-element" title="........." >
<option value="...">........</option>
</select>
</div>
</td>
<td>
<div class="col-xs-12 nopadding">
<select class="selectpicker form-element" >
<option value="......">........</option>
</select>
</div>
</td>
</tr>
</tbody>
</table>
Your .table needs to be nested INSIDE a .table-responsive class as per Bootstrap's documentation:
Responsive tables Create responsive tables by wrapping any .table in
.table-responsive to make them scroll horizontally on small devices
(under 768px). When viewing on anything larger than 768px wide, you
will not see any difference in these tables.
You have the .table-responsive in the same element as the .table.
I'm using Bootstrap 3 and have issues with a table inside an iFrame or any contents. I want the iFrame contents to be treated as part of the page.
I've already removed the iFrame borders just to be clear.
So for instance if the iFrame is 1000 pixels in width the contents inner page width should also be 1000px # 100%.
I am using Bootstrap 3.
As you can see in the example, the iFrame has a scrollbar as it thinks its page size is 1920 width.
<?php if(login_check($mysqli)==true): ?>
<body>
<div class="row-fluid">
<div class="col-md-4">
<h3>Clients</h3>
</div>
<div class="col-md-8">
<select>
<option value="name">First Name</option>
<option value="surname">Surname</option>
<option value="company">Company</option>
<option value="date">Date</option>
</select>
</div>
<div class="col-md-12">
<table id ="example" class="table table-striped table-bordered">
<thead>
<tr>
<th>Account</th>
<th>Name</th>
<th>Surname</th>
<th>Phone</th>
<th>Unit</th>
<th>Street</th>
<th>type</th>
<th>Suburb</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<?php
$clients_list = "SELECT * FROM clients_table";
$details = $mysqli->query($clients_list);
while($row = mysqli_fetch_array($details)) {
echo '
<tr>
<td><input type="text" value="'.$row['_account'].'" id="_account'.$row['_account'].'" readonly="readonly"/></td>
<td><input type="text" value="'.$row['_first'].' " id="_first'.$row['_id'].'"/></td>
<td><input type="text" value="'.$row['_surname'].'"id="_surname'.$row['_id'].'"/></td>
<td><input type="text" value="'.$row['_phone'].'"id="_phone'.$row['_id'].'"/></td>
<td><input type="text" value="'.$row['_unit'].'" id="_unit'.$row['_id'].'"/></td>
<td><input type="text" value="'.$row['_street'].'" id="_street'.$row['_id'].'"/></td>
<td><input type="text" value="'.$row['_type'].'" id="_type'.$row['_id'].'"/></td>
<td><input type="text" value="'.$row['_suburb'].'"id="_suburb'.$row['_id'].'"/></td>
<td><input type="text" value="'.$row['_email'].'"id="_email'.$row['_id'].'"/></td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
This is the code for that in bootstrap.css
Please try it.
.table-responsive {
min-height: .01%;
overflow-x: auto;
}
#media screen and (max-width: 767px) {
.table-responsive {
width: 100%;
margin-bottom: 15px;
overflow-y: hidden;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #ddd;
}
As far as i know if the page that is being loaded in your iframe is responsive then you will have no problem at all.
So if you set height & width at 100% then it will "fit" exactly in the iframe, making it look like part of your primary webpage.
I have a jsfiddle below:
http://jsfiddle.net/C95uc/3/
I am having trouble with my css. I want to display both drop down menus on the left above one another and I want to display the text inputs on the right hand side, but how can I do this?
Below is the html code:
<div class='lt-container'>
<form id='moduleForm'>
<select name="module" id="modulesDrop">
<option value="">Please Select Module</option>
</select>
</form>
</div>
<div class='lt-container' >
<form id='moduleExistForm'>
<select name="module" id="modulesDrop">
<option value="">Please Select Course</option>
</select> </form>
</div>
<div id='rt-container' >
<form id='detailsForm'>
<table>
<tr>
<th></th>
<td><input type='hidden' id='idmodule' name='moduleid' value='' /> </td>
</tr>
<tr>
<th>Module ID:</th>
<td><input type='text' id='nomodule' name='moduleno' readonly='readonly' value='' /> </td>
</tr>
<tr>
<th>Module Name:</th>
<td><input type='text' id='namemodule' name='modulename' readonly='readonly' value='' /> </td>
</tr>
<tr>
<th>Credits:</th>
<td><input type='text' id='credits' name='creditsname' readonly='readonly' value=''/> </td>
</tr>
</table>
<div id='moduleAlert'></div>
</form>
</div>
CSS:
.lt-container, #rt-container {
float: left;
}
#rt-container {
clear: right;
margin-left: 5%;
}
http://jsfiddle.net/C95uc/4/
<div class='lt-container'>
<form id='moduleForm'>
<select name="module" id="modulesDrop">
<option value="">Please Select Module</option>
</select>
</form>
<form id='moduleExistForm'>
<select name="module" id="modulesDrop">
<option value="">Please Select Course</option>
</select> </form>
</div>
Both <select> go in the same <div class='lt-container'>
The two dropdowns don't stack on top of each other because you have assigned both of them a "float:left" property which makes them go side by side. Instead, wrap them in a div and make that div float left.
<div class="lfloat">
<!-- Both Dropdowns -->
</div>
CSS:
.lfloat {
float:left;
}
Be sure to add a "float:right" property to the form so that it doesn't appear below the two drop downs.
Example: http://jsfiddle.net/C95uc/5/
So I am web developer who used to have a kind graphics design person help me out on this sort of browser compatibility hell, but alas he has moved on to greener pastures. The following html looks fine and dandy on chrome, but the table I am using to align my form is sleeping on the job on the bottom in ie and firefox. Should I never use tables? Is the float in the div tags screwing everything up? Any hints or suggestions for improving my html and css would be much appreciated.
Also, the text area text gets a little screwy sometimes in terms of where it is positioned in the box.
Thank you all.
<div style="border-style:solid; border-color:#336699; padding: 5px; margin-left:auto; margin-right:auto; width:600px; height:300px;" id="demoContainer">
<div style="" id="demo">
<div style="" id="demoHeader">
<img src="someimage" />
<span style="font-size:32px;">Demo</span>
</div>
<div style="" id="demoBody">
<form method="get">
<div style="float:left; padding:5px;" id="demoBodyText">
<textarea style="resize:none;" rows="10" cols="30">
Enter demo text here...
</textarea>
</div>
<div style="float:right; padding:5px;" id="demoBodyOptions">
<table style="float:right;">
<tr>
<th>
Option 1:
</th>
<td>
<select style="">
<option>asdf</option>
</select>
</td>
</tr>
<tr>
<th>
Option 2:
</th>
<td>
<select style="align:left;">
<option value="320">Fastest</option>
<option value="260">Faster</option>
<option value="200">Fast</option>
<option value="170" selected="selected">Default</option>
<option value="130">Slow</option>
<option value="110">Slower</option>
<option value="80">Slowest</option>
</select>
</td>
</tr>
<tr>
<th>
Option 3:
</th>
<td>
<select>
<option value="4.2">Highest</option>
<option value="3">Higher</option>
<option value="2">High</option>
<option value="1" selected>Default</option>
<option value="0.8">Low</option>
<option value="0.6">Lower</option>
<option value="0.4">Lowest</option>
</select style="align:left;">
</td>
</tr>
<tr>
<th>
Option 4
</th>
<td>
<select>
<option value="none">None</option>
</select style="align:left;" >
</td>
</tr>
<tr>
<td>
<input type="submit" />
</td>
</tr>
</table>
</div>
</form>
</div>
<div style="clear:both;" id="demoFooter">
Footer
</div>
</div>
</div>
EDIT: Added image in how it displays in my firefox version 10.
If you have a float:right after a float:left this seems pretty normal.
Try to switch the order of the two or give the second one also float:left
Or maybe the padding is the problem?
http://jsfiddle.net/HerrSerker/55cXT/
What are the width of your floated divs #demoBodyText and #demoBodyOptions?
See the fiddle - Is this you are looking for?
Fiddle: http://jsfiddle.net/jKtkq/
Demo: http://jsfiddle.net/jKtkq/embedded/result/
Screen shot: http://img39.imageshack.us/img39/7676/tableissue.jpg
Consider the following HTML snippet. The desired effect is to have a dropdown be positioned right above a table.
<!-- this is actually in a proper CSS class, not inline-->
<div style="float:left;
min-height:1px;
padding:15px 2% 20px;
position:relative;
width:96%;">
<form method="post">
<div style="float:right;display:inline;">Show Me:
<select id="ddNumRecords" name="ddNumRecords" onchange="this.form.submit();">
<option>30</option>
<option>50</option>
<option>100</option>
</select>
</div>
The above renders like this:
table and select float right http://www.imagechicken.com/uploads/1253124526051538700.png
Question: How can I write my CSS to achieve positioning like this mockup?
desired http://www.imagechicken.com/uploads/1253124791005327900.png
Add clear: both; to your table's CSS. This will clear the float of the div (with the dropdown) above it.
But why don't you just text-align: right; your div, then you don't have to mess with floats and inline divs. That should work as well.
One way would be to add absolute positioning to both divs.
or
Other way would be to use table. For example:
<table>
<tr><td>
<form method="post">
<div style="float:right;display:inline;">Show Me:
<select id="ddNumRecords" name="ddNumRecords" onchange="this.form.submit();">
<option>30</option>
<option>50</option>
<option>100</option>
</select>
</div>
</form>
</td></tr>
<tr><td>
<div>
<div style="float:left;
min-height:1px;
padding:15px 2% 20px;
position:relative;
width:96%;">
hello world
</div>
</td></tr>
</table>
or
Add one more div around the div that has float:right. For example:
<form method="post">
<div style="float:left; width:300px">
<div style="float:right;display:inline;">Show Me:
<select id="ddNumRecords" name="ddNumRecords" onchange="this.form.submit();">
<option>30</option>
<option>50</option>
<option>100</option>
</select>
</div>
</div>
<div>
<div style="float:left;
min-height:1px;
padding:15px 2% 20px;
position:relative;
width:96%;">
hello world
</div>
you could make another cell for the table
<table>
<tr>
<td colspan="2">
<div style="float:right;display:inline;">Show Me:
<select id="ddNumRecords" name="ddNumRecords" onchange="this.form.submit();">
<option>30</option>
<option>50</option>
<option>100</option>
</select>
</div>
</td
</tr>
<tr>
<td>table head</td>
<td>table head</td>
</tr>
<tr>
<td>content1</td>
<td>ontent2</td>
</tr>
<tr>
<td>content3</td>
<td>content4</td>
</tr>
</table>
this should work.. or you could use css. but this is the fastest way to do it:-? at least until you make/find some css. you could use float left on both divs