I am doing a design for mobile and I have to think in differents devices. I put a button-group in bottom of the page. It's means the bottons appear at the final of the scroll-bar. But, when the page its too small because the device is big, the bottons appear at the middle of the page. And after that, there is white space.
I try with this rules: How to put the footer at the bottom of the visible page? But the buttons appear always at the bottom of the screen. I need see the bottons after using scroll-bar.
HTML
<div id="botoneraInternet" class="btn-group btn-group-justified" role="group" aria-label="...">
<div class="btn-group btn-group-lg" role="group">
<button type="button" class="btn btn-default" id="botonHardware" disabled="" style="background-color: rgb(48, 144, 184);">
<span><img class="icons" src="imagenes/llave.png"></span> Hardware
</button>
</div>
<div class="btn-group btn-group-lg" role="group">
<button type="button" class="btn btn-default" id="botonClose" style="background-color: rgb(223, 228, 229);">
<span><img class="icons" src="imagenes/valija.png"></span> Cerrar WO
</button>
</div>
</div>
CSS
.btn-group {
position: relative;
vertical-align: middle;
}
.btn-group-justified {
display: table;
width: 100%;
table-layout: fixed;
border-collapse: separate;
}
Someone can help me?
Really thanks, and I am going to give the star to the best answer.
try this....there wasn't enought code you provided so I improvised a bit. But let me know if this is what you need.
http://codepen.io/carinlynchin/pen/WvbLXE
CSS:
body{
height:900px;
position:relative;
}
.btn-group {
position: absolute;
width:100%;
bottom:0
}
.btn-group div {
display:inline;
}
HTML:
<div id="botoneraInternet" class="btn-group btn-group-justified" role="group" aria-label="...">
<div role="group">
<button type="button" class="btn btn-default" id="botonHardware" disabled="" style="background-color: rgb(48, 144, 184);">
<span><img class="icons" src="http://barkpost-assets.s3.amazonaws.com/wp-content/uploads/2013/11/grumpy-dog-11.jpg"></span> Hardware
</button>
</div>
<div role="group">
<button type="button" class="btn btn-default" id="botonClose" style="background-color: rgb(223, 228, 229);">
<span><img class="icons" src="https://pbs.twimg.com/profile_images/3540744128/7dd80644ae052f1b04180c41bbc674ab.png"></span> Cerrar WO
</button>
</div>
</div>
Related
I have a btn-toolbar inside my panel-body, and would like to:
Center the set of buttons
Ensure that on mobile view, three buttons are on top, three are on the bottom.
There are a lot of similar questions out there, and I have tried various potential solutions, but nothing seems to work (text-align: center, margin: 0 auto, etc.). Any help would be appreciated.
http://codepen.io/kli96/pen/vydMgW
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="btn-toolbar">
<button type="button" class="btn btn-primary" id="btn2016">2016</button>
<button type="button" class="btn btn-primary" id="btn2015">2015</button>
<button type="button" class="btn btn-primary" id="btn2014">2014</button>
<button type="button" class="btn btn-primary" id="btn2013">2013</button>
<button type="button" class="btn btn-primary" id="btn2012">2012</button>
<button type="button" class="btn btn-primary" id="btn2011">2011</button>
<button type="button" class="btn btn-primary" id="btn2010">2010</button>
</div>
</div>
</div>
</div>
</div>
</div>
To make sure the buttons are centers you can set the container of the buttons to display: inline-block and that container with text-align: center.
You have 7 buttons, but with the above changes they look ok on mobile.
Here is the CSS you need:
.panel-body {
text-align: center;
}
.btn-toolbar {
display: inline-block;
}
.btn-toolbar .btn {
margin-bottom: 5px;
}
Check the codepen:
http://codepen.io/anon/pen/MbQRrY
I have a question regarding the vertical alignment of a button group within a row, using bootstrap.
This is an image that explains what I'm trying to achieve
And the following code is used in my current project:
body {
padding-top: 50px;
padding-bottom: 20px;
}
/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}
/* Override the default bootstrap behavior where horizontal description lists
will truncate terms that are too long to fit in the left column
*/
.dl-horizontal dt {
white-space: normal;
}
/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
max-width: 280px;
}
<div class="row">
<div class="col-sm-9">
#if (item.Completed) {
<h4><span class="label label-success">Completed</span> #item.Procedure.Title</h4>
} else {
<h4><span class="label label-danger">Not completed</span> #item.Procedure.Title</h4>
}
<div class="row">
<div class="col-sm-6">
<dl class="dl-horizontal">
<dt>Time required:</dt>
<dd>#item.Procedure.Time</dd>
<dt>Material required:</dt>
<dd>#item.Procedure.Material</dd>
<dt>Engineers required:</dt>
<dd>#item.Procedure.Engineers</dd>
<dt>Documentation:</dt>
<dd>#item.Procedure.Documents</dd>
</dl>
</div>
<div class="col-sm-6">
<dl class="dl-horizontal">
<dt>Status:</dt>
<dd>#item.Status</dd>
<dt>Note:</dt>
<dd>#item.Note</dd>
</dl>
</div>
</div>
</div>
<div class="col-sm-3" style="vertical-align: middle;">
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-success" role="group">
<span class="glyphicon glyphicon-ok"></span>
OK
</button>
<button type="button" class="btn btn-danger" role="group">
<span class="glyphicon glyphicon-remove"></span>
Not OK
</button>
<button type="button" class="btn btn-info" role="group" data-toggle="modal" data-target="#noteModal#(item.ID)">
<span class="glyphicon glyphicon-pencil"></span>
Add note
</button>
</div>
<div id="noteModal#(item.ID)" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add note</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="form-group">
<label for="note">Note:</label>
<textarea class="form-control" rows="5" id="note" style="min-width: 100%;"></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Add note</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
Any help apreciated, thanks!
I solved the problem using the flex property on the outer .row
.row-flex {
display: flex;
align-items: center;
}
Image
This is what I did:
.btn-group {
flex-wrap: wrap;
width: 80px;
}
button{
width:80px;
}
Here is the JSFiddle demo
I have a bootstrap sidebar that contains a couple buttons. Unfortunately, it looks very ugly and I want each button to be the same size.
These buttons are contained in a sidebar and will be stack vertically. I want to avoid setting a pixel number for each button. Here is the jfiddle
https://jsfiddle.net/66bk2rfc/
HTML
<div id="reading-sidebar" class="col-xs-3 panel-default">
<div id="reading-sidebar-title" class="panel-heading">Options
<button type="button" class="btn btn-xs btn-default pull-right" id="reading-sidebar-hide-btn"><i class="glyphicon glyphicon-remove"></i></button>
</div>
<div id="reading-sidebar-contents" class="panel-body">
<ul class="sidebar-button-list">
<button type="button" id="pre-reading-btn" class="btn btn-default pull-left"><i class="glyphicon glyphicon-minus"></i> Pre Readings</button><br>
<button type="button" id="passage-btn" class="btn btn-default pull-left"><i class="glyphicon glyphicon-minus"></i> Passage</button><br>
<button type="button" id="post-reading-btn" class="btn btn-default pull-left"><i class="glyphicon glyphicon-minus"></i> Post Readings</button><br>
<button type="button" id="media-btn" class="btn btn-default pull-left"><i class="glyphicon glyphicon-minus"></i> Media</button><br>
<button type="button" id="question-btn" class="btn btn-default pull-left"><i class="glyphicon glyphicon-minus"></i> Questions</button>
</ul>
</div>
</div>
The "bootstrap" way to do this would be to use btn-block on your button elements. Like so:
<button type="button" class="btn btn-primary btn-lg btn-block">Full-width Button</button>
You can also just surround them with <div class="btn-group-lg btn-group-vertical">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div id="reading-container" class="col-xs-6">
<div id="reading-sidebar" class="col-xs-3 panel-default"></div>
<div id="reading-sidebar-contents" class="panel-body">
<div class="btn-group-lg btn-group-vertical">
<button type="button" id="pre-reading-btn" class="btn btn-default"><i class="glyphicon glyphicon-minus"></i> Pre Readings</button>
<button type="button" id="passage-btn" class="btn btn-default"><i class="glyphicon glyphicon-minus"></i> Passage</button>
<button type="button" id="post-reading-btn" class="btn btn-default"><i class="glyphicon glyphicon-minus"></i> Post Readings</button>
<button type="button" id="media-btn" class="btn btn-default"><i class="glyphicon glyphicon-minus"></i> Media</button>
<button type="button" id="question-btn" class="btn btn-default"><i class="glyphicon glyphicon-minus"></i> Questions</button>
</div>
</div>
</div>
If I get your question right. Do you mean this:
#reading-sidebar-contents .btn{
width:200px;
}
Here is fiddle: https://jsfiddle.net/66bk2rfc/6/
I changed your fiddle to match a solution. You can give your sidebar a width of 100%. Then you can just make your buttons 80% with one line of css and make them stay in the middle with the margin:0 auto. If you want to adjust your size of the buttons, you can easely change it with just the one line. You could also add the text-align:left, set a font-size for all the buttons,... for better styling to the buttons.
#reading-sidebar
{
width:80%;
margin:0 auto;
}
#reading-sidebar-contents button
{
width:100%;
margin:0 auto;
}
Link: https://jsfiddle.net/66bk2rfc/1/
I suggess You to do it like this:
.btn {
width: 100%;
height: 56px;
padding-left: 2% !important;
}
.btn i {
left: 10px;
width: 10%;
top: 25%;
height: 50%;
}
.btn.pull-left {
text-align: left;
}
Also if you just want only these affect to sidebar buttons, add
#reading-sidebar .btn { } ETC...
If you want it not 100% width and centered, You should do it like this,
.btn { width: 80%; margin-left: 10%; }
That will make it centered easily. :)
Made this Bootply example and I'm wondering how can I get the same width for normal button and a button group consisting of 3 buttons.
Tried it with an css extension but I don't think that is the correct way in sense of the bootstrap grid system.
I know that there is something like .btn-group-justified but using of that class also changes the first ("<") and last element (">") width, but they should be fixed.
Any ideas?
.menu_button {
min-width: 170px;
max-width: 200px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="btn-toolbar">
<div class="btn-group">
<button class="btn btn-default menu_button">First</button>
</div>
<div class="btn-group">
<button class="btn btn-default menu_button">Second</button>
</div>
<div class="btn-group">
<button class="btn btn-default"><</button>
<button class="btn btn-default menu_button">3rd</button>
<button class="btn btn-default">></button>
</div>
<div class="btn-group">
<button class="btn btn-default"><</button>
<button class="btn btn-default menu_button">4th</button>
<button class="btn btn-default">></button>
</div>
</div>
</div>
</div>
How's this?
I created a separate class for grouped buttons so that they could have separate stylings.
SIDE NOTE
Bootstrap buttons are styled to be responsive as the viewport changes. So styling them as you did may work, but may not be responsive unless you add your own media queries in CSS to change the size of them as the viewport changes.
.menu_button {
min-width: 170px !important;
max-width: 200px !important;
}
.menu_button_grouped {
min-width: 104px !important;
max-width: 134px !important;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="btn-toolbar">
<div class="btn-group">
<button class="btn btn-default menu_button">First</button>
</div>
<div class="btn-group">
<button class="btn btn-default menu_button">Second</button>
</div>
<div class="btn-group">
<button class="btn btn-default"><</button>
<button class="btn btn-default menu_button_grouped">3rd</button>
<button class="btn btn-default">></button>
</div>
<div class="btn-group">
<button class="btn btn-default"><</button>
<button class="btn btn-default menu_button_grouped">4th</button>
<button class="btn btn-default">></button>
</div>
</div>
</div>
</div>
I hope this helps!
.buttons-group {
min-width: -webkit-fill-available;
justify-content: space-evenly;
}
.button-group {
width: -webkit-fill-available;
}
I am working on a bootstrap 3 project at the moment and i have added a button called "Add Shipment, i want this button to stay fixed to the right hand side of the panel but when I give it the style of float:right or class of pull-right, it doesn't work.
The design must be responsive so therefore I cannot just give it a class of float: left and then put margin-left: XXX
Please let me know if you know how to solve this, the code and screenshot are below.
<div class="row" style="margin-top:-20px;">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-primary panel-table" style="border-radius:50px">
<div class="panel-heading" style="background-color:#EFEFEF; border: 1px solid #CCCCCC; height:45px; width:auto">
<div class="panel-title" style="padding:0; width:auto" >
<div class="input-group input-group-sm" style="width:200px; margin-top:7px; margin-left:10px; float:left">
<span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
<input type="text" class="form-control" placeholder="Filter">
</div>
<div class="btn-group" style="float:left; margin-left:25px; margin-top:6px">
<button type="button" class="btn btn-default">All</button>
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-ok"></span></button>
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-road"></span></button>
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-exclamation-sign"></span></button>
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span></button>
</div>
<button class="btn btn-info" style="margin-top:6px; float:right">Add Shipment</button>
</div>
</div>
<div class="panel-body" style="background-color:#F2F2F2; border: 1px solid #CCCCCC; height:200px">
</div>
</div>
</div>
Current screenshot of results from that code:
I tried copying and pasting your code to see how things look, and it looks fine. I see that the Add Shipment button is pulled to the right. You must have something in your CSS stylesheet that is preventing the button from being floated to the right