When I resize this fiddle, the input box gets larger when I shrink the screen. Unfortunately on the iPhone, it's going off the screen in my app.
Here is the fiddle: http://jsfiddle.net/v6Bhx/5/embedded/result/ and here is the code:
<div class="row-fluid">
<div class="span6">
<table width="500">
<tr>
<td>
<div class="input-prepend">
<span class="add-on">$</span>
<input type="text" name="fee" value="" class="span6" />
</div>
</td>
</tr>
</table>
</div>
<div class="span6">Test</div>
</div>
Also yes, I realize I am using tables. I am not doing this to format data, it is actually being used for tabular data which happens to have input boxes in it.
Either set a width on slider :
<input style="width:125px;" type="text" name="fee" value="" class="span6" />
or use css
.span6 { width: 125px; }
The reason is the table is changing row widths on page resize
My suggestion is to use table width="100%" .
<div class="row-fluid">
<div class="span6">
<table width="100%">
<tr>
<td>
<div class="input-prepend"> <span class="add-on">$</span>
<input type="text" name="fee" value="" class="span6"
/>
</div>
</td>
</tr>
</table>
</div>
<div span="6">Test</div>
</div>
Setting the table width # 500px will likely cause a problem as the viewpoint shrinks to mobile size. Try removing the table width and see what happens.
Update
I can't picture exactly how you want the final page and table to look, but here are a few additional points you could check.
Regarding the iPhone display issue, make sure that in the head of your page you have:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
I think that specifying a table width of 100% will be invalid HTML5. I doubt that this is the source of your problem, but try something like this in your CSS:
.span6 table{
width:100%;
}
I can see that having the form with an input prepend inside a table is going to be a challenge. If there is no way around this, you have a nesting problem at the moment -- the input.span6 is actually nested inside the another span6 column.
In general, the HTML for a nested grid with fluid rows is:
<div class="row-fluid">
<div class="span6">
<div class="row-fluid"> <!-- start nested grid -->
<div class="span12">
<!-- Form and table details here -->
</div> <!-- end nested span -->
</div> <!-- end nested row -->
</div> <!-- end span6 -->
<div class="span6">
test
</div>
</div>
See the fluid nesting section on http://twitter.github.com/bootstrap/scaffolding.html#gridSystem for full details.
Good luck!
Related
I am trying to achieve above on the webpage with this:
<div class="columns">
<div class="column">
<div class="field">
<div class="control"><input type="text" class="input">
</div>
</div>
</div>
<div class="column">
<div class="select">
<select>
<option>January</option>
</select>
</div>
</div>
<div class="column">
<div class="field">
<div class="control"><input type="text" class="input">
</div>
</div>
</div>
</div>
But am getting this:
Am using bulma columns and form controls. Can you please help me, I need to horizontally pack elements at various places if you have any other good way to achieve it please let me know.
When using columns in bulma, you should know that all columns will be of equal width. See here:
Each column will have an equal width, no matter the number of columns.
That is also the case in your case. The columns are equal in size. The content of the columns, however, is not equal. The input elements have width:100% whereas the select does not.
To fix it, simply add width:100% to the select and its .select container:
.select,
select{
width:100%;
}
I have the following code in HTML, using bootstrap:
<div class="panel-body">
<form class="form-horizontal" role="form">
<div class="container-fluid form-group" ng-repeat="app in allKeys track by $index">
<label for="inputEmail2" class="col-md-4 control-label">{{app}}</label>
<div class="col-sm-6 table-responsive">
<table class="table">
<tr>
<td ng-repeat="app1 in allDesc[$index]"><b> {{app1}}</b> </td>
</tr>
<tr >
<td ng-repeat="app2 in allValues[$index]"> {{app2}} </td>
</tr>
</table>
</div>
</form>
</div>
I have two main problem:
If the text is too long in the label section ({{app}}), the text is continue in the line, and override the text in the table section.
If I minimize the browser windows, the container doesn't get the correct size.
I think that this issues are result of definition in the css, that should adjust the text to the appropriate size of the window/column, but I didn't find any css definition for that.
As mentioned in the comments, your main problem is just a missing closing <div> tag. You haven't closed the container-fluid. You can see it working in this Bootply
I also changed your col-md-4 to col-sm-4, as your table wrapper was using sm definitions, which meant that your label would have broken to full width at 'medium' size and your table would have broken to full width at 'small' size, which caused some layout inconsistencies.
you can try this code :
<div class="panel-body">
<form class="form-horizontal" role="form">
<div class="container-fluid form-group row" ng-repeat="app in allKeys track by $index">
<div class="col-sm-6">
<label for="inputEmail2" class="col-md-4 control-label">{{app}} </label></div>
<div class="col-sm-6 table-responsive">
<table class="table">
<tr>
<td ng-repeat="app1 in allDesc[$index]"><b> {{app1}}</b> </td>
</tr>
<tr >
<td ng-repeat="app2 in allValues[$index]"> {{app2}} </td>
</tr>
</table>
</div>
</form>
</div>
making the width to 100% and splitting the blocks accordingly, will help the browser to display the content in a proper way and remember to close the "div" whenever the content for the div is over. Else, the following content will go with misplacement.
I have a page which breaks down as follows:
<div class="container-fluid" style="min-width:768px">
<div id="main-sidebar"></div>
<div id="main-frame"></div>
<div id="supplementary-sidebar"></div>
<div id="content-container"></div>
<!-- ALL THE INTERESTING CODE GOES HERE -->
<div id="content" class="row"></div>
</div>
</div>
<footer></footer>
</div>
The widths of all the elements in container fill the screen width.
The main-sidebar's width is set to auto.
The main-frame is set to min-width of 72.65%.
The supplementary-sidebar is at 20% of the parent main-frame.
The content-container is at 80% of the parent main-frame.
Basically I want the main-sidebar to be as big as it need to be,
and then have the main-frame fill up the rest of the parent page.
I succeeded at this by accident and have pinpointed the Twitter Bootstrap class that gets the job done. The screen will not fill if I remove it. This is:
<div class="btn-group-justified" style=""></div>
I have tried many different lines of code (included below), which were attempts at doing this consciously. But at this point I can't really go much further.
Does anybody know why this forces the main-frame to fill up the screen?
Here are my attempts:
<!---
NOTHING HERE WORKS
<div style="width:100%"> </div>
<div style="display:table;width: 100%;table-layout: fixed;border-collapse:seperate;display: block;"></div>
<div style="display:table;width: 100%;table-layout: fixed;border-collapse:seperate;display: block;"> </div>
<div id="spreader" class="row" style="">
<div class="col-sm-12">
</div>
</div>
<div id="spreader"></div>
#spreader{
display:table;
width: 100%;
table-layout: fixed;
border-collapse:seperate;
display: block;
}
-->
<!--- THIS IS HOW I ORGINALLY GOT IT TO WORK
<div class="row" style="">
<div class="col-sm-12">
<div class="btn-group btn-group-justified" style="">
</div>
</div>
</div>
-->
Here is the the screenshot showing the relevant bootstrap code. For some reason, this still works when I take border-collapse out. But if I include just this in a class like I did with #spreader above (and even if I include border-collapse) it will still not work.
I have a table with two columns, the right one contains 3 buttons, those buttons change the content in the other column of the table. I want this table to be positioned at the center top of the page but I can't figure out how to do it.
Here is a screenshot of what I want (the image shows a header too, but it's not important for now)
If it is possible I want the buttons to don't move when the content on the other column changes, but it's not a priority.
I can also change the table with another structure if this will help.
Here is html code:
<div class='main'>
<table class="table">
<tr>
<td>
<input type="button" class="button" value="edit_menu"/><br><br>
<input type="button" class="button" value="edit_desc"/><br><br>
<input type="button" class="button" value="set_push"/>
</td>
<td>
<div id="content">
<div id="edit_menu" display="none" class="form">
here is a simple form
</div>
<div id="edit_desc" display="none" class="form">
here is a second form
</div>
<div id="set_push" display="none" class="form">
here is a third form
</div>
</div>
</td>
</tr>
</table>
</div>
The forms visibility is changed via Javascript when the buttons are pressed.
Try using the below code.
css :
body {margin:0; padding:0;}
.wrapper {width: 500px /* width of your table*/; margin:0 auto;}
html :
<div class="wrapper">
<!-- put your table here -->
</div>
<body>
<div class="container">
<div class="row">
<div class="offset4 span4">
<h1 class="text-center">Days</h1>
<form method="post" action="proc/days.php" id="jobs">
<div class="input-prepend">
<span class="add-on">Job Count</span>
<input type="text" class="day1">
</div>
<div class="input-prepend">
<span class="add-on">Day Name</span>
<input type="text" class="day2">
</div>
</form>
</div>
</div>
</div>
</body>
is my primary block of code (with all the other stuff striped out). I want to get the input-prepend to take up all the width available in the span4.
Right now, the only tricks I can find end up not working, or being way to large.
Also, I am using the Cosmo Bootswatch theme.
Setting .day1 to 76% width (after padding and borders are considered etc) will fill up your space. Problem would then be that you have another element depending on the .day1 class. So add an id, or example like:
<input type="text" class="day1" id="day1">
and then use #day1 {width:76%;} in your css. You'd most likely need to adjust the width size as your screen width changes though (through media queries).