Positioning list-group-item buttons - html

I am trying to create this list-group-item example below with two buttons (instead of just one) that should pull to right and also be of equal height to the list-group-item itself:
At the moment I do have the skeleton working, but as you can see they are not positioning correctly.
Thanks.
li.group-btn {
padding: 0;
border-radius: 0;
}
.form-control,
.btn {
border-radius: 0 !important;
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item">
<div class="input-group">
<span class="pull-right">
<button class="btn btn-default" type="button">Go!</button>
</span>
<span class="pull-right">
<button class="btn btn-default" type="button">Go!</button>
</span>
<span class="left">Cras justo odio</span>
</div>
<!-- /input-group -->
</li>
</ul>
</div>

You can use i.e display: table; / display: table-cell;
li.group-btn {
padding: 0;
border-radius: 0;
}
.form-control,
.btn {
border-radius: 0 !important;
}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item">
<div class="input-group" style="display:table; width:100%;">
<span style="display: table-cell; border:1px solid #ccc; padding: 0 8px; vertical-align: middle;">Cras justo odio</span>
<span style="display: table-cell; width: 40px;">
<button class="btn btn-default" type="button"><span>ᐅ</span> Go!</button>
</span>
<span style="display: table-cell; width: 40px;">
<button class="btn btn-default" type="button"><span>ᐅ</span> Go!</button>
</span>
</div>
<!-- /input-group -->
</li>
</ul>
</div>

Related

Add Spacing Between Two Inline-Block Elements

I have a modal button next to my header and both elements have display: inline-block;. I am trying to make spacing and have the button go further to the right and keep the header element centered.
I tried adjusting the padding of the item container and that still did not work?
.btn.btn-info.btn-md {
background: #104723;
border-color: #104723;
border-radius: 3px;
float: right;
display: inline-block;
position: absolute;
}
.btn.btn-info.btn-md:active {
background: #104723;
border-color: #104723;
border-radius: 3px;
float: right;
display: inline-block;
position: absolute;
margin-right: -40px;
}
.pageheadh {
font-size: 30px;
font-weight: bolder;
color: black;
text-align: center;
display: inline-block;
}
.pageheadp {
text-align: center;
color: black;
font-weight: bold;
}
.center {
align-items: baseline;
justify-content: center;
text-align: center;
padding-right: 10px;
}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
<!-- Datatables -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<script src="https://nightly.datatables.net/js/dataTables.bootstrap.js"></script>
<!-- Trigger the modal with a button -->
<div class="center">
<h3 class="pageheadh">Fitness Tracker</h3>
<button type="button" class="btn btn-info btn-md" data-toggle="modal" data-target="#myModal" >Prize Plaza</button>
</div>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<embed src="https://ak.picdn.net/shutterstock/videos/3998236/thumb/3.jpg" frameborder="0" width="100%" height="100%">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<p class="pageheadp">Click on any of the tabs to track your progress in that category. </p>
<!--<input type="text" class="global_filter" id="global_filter">-->
<div class="clearfix"></div>
<ul class="nav nav-tabs">
<li class="active"> Weekly Weight Δ
</li>
<li>Total Weight Δ
</li>
<li>Weekly Steps
</li>
<li>Total Steps
</li>
<li>Weekly Minutes
</li>
<li>Total Minutes
</li>
<li>Step Points
</li>
<li>Exercise Points
</li>
<li>Weekly Winners
</li>
</ul>
First add position: relative to .center to correctly position the button with absolute positioning.
And add this ruleset for .btn.btn-info.btn-md selector:
top: 0;
bottom: 0;
height: 40px;
margin: auto auto auto 50px;
.btn.btn-info.btn-md {
background: #104723;
border-color: #104723;
border-radius: 3px;
float: right;
display: inline-block;
position: absolute;
top: 0;
bottom: 0;
height: 40px;
margin: auto auto auto 50px;
}
.btn.btn-info.btn-md:active {
background: #104723;
border-color: #104723;
border-radius: 3px;
float: right;
display: inline-block;
position: absolute;
margin-right: -40px;
}
.pageheadh {
font-size: 30px;
font-weight: bolder;
color: black;
text-align: center;
display: inline-block;
}
.pageheadp {
text-align: center;
color: black;
font-weight: bold;
}
.center {
align-items: baseline;
justify-content: center;
text-align: center;
padding-right: 10px;
position: relative;
}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" />
<!-- Datatables -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/dataTables.bootstrap.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<script src="https://nightly.datatables.net/js/dataTables.bootstrap.js"></script>
<!-- Trigger the modal with a button -->
<div class="center">
<h3 class="pageheadh">Fitness Tracker</h3>
<button type="button" class="btn btn-info btn-md" data-toggle="modal" data-target="#myModal">Prize Plaza</button>
</div>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<embed src="https://ak.picdn.net/shutterstock/videos/3998236/thumb/3.jpg" frameborder="0" width="100%" height="100%" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<p class="pageheadp">Click on any of the tabs to track your progress in that category.</p>
<!--<input type="text" class="global_filter" id="global_filter">-->
<div class="clearfix"></div>
<ul class="nav nav-tabs">
<li class="active">Weekly Weight Δ</li>
<li>Total Weight Δ</li>
<li>Weekly Steps</li>
<li>Total Steps</li>
<li>Weekly Minutes</li>
<li>Total Minutes</li>
<li>Step Points</li>
<li>Exercise Points</li>
<li>Weekly Winners</li>
</ul>
You can add absolute positions to your button :
.btn.btn-info.btn-lg {
background: #104723;
border-color: #104723;
border-radius: 3px;
float: right;
display: inline-block;
position: absolute;
right:15px;
top: 10px;
}
Perhaps Add a
<br>
in between the two divs. If not then maybe change this.
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal" >Prize Plaza</button>
to
<button type="button" class="btn btn-info btn-lg ml-5" data-toggle="modal" data-target="#myModal" >Prize Plaza</button>
if not then change your css to
.btn.btn-info.btn-lg {
background: #104723;
border-color: #104723;
border-radius: 3px;
float: right;
display: inline-block;
position: absolute;
right:15px;
top: 10px;
margin-right: 50px;
}

Boxes cannot be sorted when using sortable()

I would like to switch the left box with the right box. I am using the function sortable() from jQuery UI. As you see in my code, it works fine for the numbers of 1 and 2 but not for the boxes to switch them left and right.
$(".sort-me").sortable({
connectWith: ".connectedSortable"
});
.title {
background: red;
}
.storename {
background: blue;
}
.row {
margin-top: 1rem;
margin-bottom: 1rem;
}
/* metatag generator relevant */
.mg-item {
display: inline-block;
}
.mg-item-inner {
display: flex;
}
.mg-item-inner .btn-group .btn .name {
margin-right: 1rem;
}
.mg-item-inner>.btn-group:not(.collapsed)>.btn:first-child {
cursor: -webkit-grab;
cursor: grab;
}
.mg-item-inner .input-group-btn:only-child>.btn {
border-radius: 4px;
}
.mg-item-inner>.btn-group,
.mg-item-inner>.input-group {
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.04), 0px 2px 6px rgba(0, 0, 0, 0.04), 0px 10px 20px rgba(0, 0, 0, 0.04);
}
.mg-item-inner>.btn-group+.input-group,
.mg-item-inner>.input-group+.input-group,
.mg-item-inner>.btn-group+.btn-group,
.mg-item-inner>.input-group+.btn-group {
margin-left: -1px;
}
.mg-item span.add {
background: transparent;
color: #444;
padding-left: 0;
margin-left: 0;
}
.mg-item span.add:active {
box-shadow: unset;
color: #313131;
}
.mg-item span.add .fa-plus-circle {
opacity: 0;
}
.mg-item:hover span.add .fa-plus-circle {
opacity: 1;
}
/*# sourceMappingURL=mg.css.map */
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/js/all.min.js"></script>
<div class="container">
<!-- Title -->
<div class="row">
<div draggable="true" class="sort-me title connectedSortable">
<div class="col-md-3">
<div class="mg-item-inner">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" data-container='body' title='Gibt den Seitentitel aus'>
<span class="name">TITLE</span><i class="fas fa-arrows-alt"></i></button>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" data-container='body' title="Linie Erweitern / Reduzieren">
<i class="fas fa-swatchbook"></i></button>
</div>
<!-- /btn-group -->
<div class="input-group" role="group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">prefix <i class="fas fa-sort"></i></button>
<ul class="dropdown-menu">
<li>prefix</li>
<li>suffix</li>
<li>none</li>
</ul>
</div>
<!-- /input-btn-group -->
<input type="text" class="form-control">
</div>
<!-- /input-group --><span type="button" class="btn add"><i class="fas fa-plus-circle"></i></span>
</div>
<!-- /mg-item-inner -->
</div>
<!-- /mg-item -->
</div>
<!--STORE NANE -->
<div draggable="true" class="sort-me storename connectedSortable">
<div class="col-md-3">
<div class="mg-item-inner">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" data-container='body' title='Fügt den Storename hinzu'>
<span class="name">STORENAME</span><i class="fas fa-arrows-alt"></i></button>
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Linie Erweitern / Reduzieren">
<i class="fas fa-swatchbook"></i></button>
</div>
<!-- /btn-group -->
<div class="input-group" role="group">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">prefix <i class="fas fa-sort"></i></button>
<ul class="dropdown-menu">
<li>prefix</li>
<li>suffix</li>
<li>none</li>
</ul>
</div>
<!-- /input-btn-group -->
<input type="text" class="form-control">
</div>
<!-- /input-group --><span type="button" class="btn add"><i class="fas fa-plus-circle"></i></span>
</div>
<!-- /mg-item-inner -->
</div>
<!-- /mg-item -->
</div>
</div>
</div>
<div class="sort-me">
<div class="connectedSortable">
<h1>
1
</h1>
</div>
<div class="connectedSortable">
<H1>2</H1>
</div>
</div>
https://jsfiddle.net/mjc9as5L/
What is the reason that the boxes can not be sorted? Is there a CSS issue maybe?
Try to add flex to your row, it might solve your problem.
.container > .row{
display:flex;
flex-direction:row-reverse;
justify-content:start;
}

Stretching input group without input field

Might be a misuse of Bootstrap's input group component, but should be achievable.
This is what I have:
And here's how I'd like to have it:
The code that needs fixing:
<div class="cont">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">foo</span>
<span class="input-group-text">bar</span>
<span class="input-group-text">This should stretch.</span>
</div>
<div class="input-group-append">
<button class="btn btn-secondary" type="button">baz</button>
<button class="btn btn-secondary" type="button">qux</button>
</div>
</div>
</div>
div.cont {
border-left: 1px dotted gray;
border-right: 1px dotted gray;
}
fiddle: https://jsfiddle.net/37o25zay/
Use boostrap class flex-grow-1 to allow the element to grow and fill the remaining space (https://getbootstrap.com/docs/4.2/utilities/flex/#grow-and-shrink)
body {
padding: 2em;
}
div.cont {
border-left: 1px dotted gray;
border-right: 1px dotted gray;
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<div class="cont">
<div class="input-group">
<div class="input-group-prepend flex-grow-1"> <!-- here -->
<span class="input-group-text">foo</span>
<span class="input-group-text">bar</span>
<span class="input-group-text flex-grow-1">This should stretch.</span> <!-- here -->
</div>
<div class="input-group-append">
<button class="btn btn-secondary" type="button">baz</button>
<button class="btn btn-secondary" type="button">qux</button>
</div>
</div>
</div>

Bootstrap Search box width in Navbar

Currently working on my navbar and would like to have the width of the search bar wider so the navbar does not look too segmented. I've played around with the width on CSS and haven't had any luck. I've also looked at similar questions on this site but have not found the solution. Please see my code below.
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">HELLO</a>
</div>
<!-- SEARCH FORM -->
<form id="navsearch" class="navbar-form pull-right" role="search" action="" method="post">
<div class="input-group" display="inline">
<input name="search" type="text" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button class="btn btn-default btn" name="submit" class="btn btn-lg" type="submit">
<span class="glyphicon glyphicon-search" ></span>
</button>
</div>
</form>
<!--Button to Upload Information -->
<div class="container text-center">
<div class="call-to-action">
Upload Your Story
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Submit</h4>
</div><!-- end modal-header -->
<div class="modal-body">
<h4></h4>
<p><small class="text-muted">Tell us</small></p>
<form action="forms.php" method="post" class="form-horizontal">
<div class="form-group">
<label class="col-lg-2 control-label" name="name" >Name</label>
<div class="col-lg-10">
<input class="form-control" name="name" placeholder="Name" type="text">
</div>
</div>
<div class="form-group" method="post">
<label class="col-lg-2 control-label" name="yourStory">Your Tell All</label>
<div class="col-lg-10">
<textarea class="form-control" name="yourStory" placeholder="Tell us your story" rows="3"></textarea>
</div>
<div class="form-group">
<label class="col-lg-2" for="inputFile">File input</label>
<input type="file" name="inputfile" id="inputFile">
</div>
<br>
<div class="form-group">
<div class="col-lg-10">
<button name="submit" class="btn btn-success active" type="submit">Submit</button>
</div>
</div>
</form>
</div><!-- end modal-body -->
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" type="button">Close</button> <button class="btn btn-primary" type="button">Save changes</button>
</div><!-- end modal-footer -->
</div><!-- end modal-content -->
</div><!-- end modal-dialog -->
</div><!-- end myModal -->
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
CSS
/* --------------------------------------
Navbar
-------------------------------------- */
.navbar-default {
border-color: rgba(255,255,255, 0.7);
font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
background-color: rgba(255,255,255, 0.7);;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
#searchInput {
width: 200px;
}
.navbar-brand {
padding: 13px 15px;
}
#mainNav{
padding-top: 10px;
padding-left: 20px;
}
#search{
width: 500px;
This may help as it's an alternate way of setting up your navbar so you can adjust your search input to whatever makes sense and use media queries with it.
*I also adjusted your modal because it was in the from place and had some errors in it etc. See working example.
body,
html {
margin-top: 60px;
}
.navbar.navbar-custom {
border: none;
background: white;
-webkit-box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.15);
-moz-box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.15);
box-shadow: 5px 5px 5px 0px rgba(50, 50, 50, 0.15);
}
.navbar.navbar-custom .form-search {
right: 0;
top: 0px;
position: fixed;
margin: 0;
border: none;
}
.navbar.navbar-custom .form-search .search-box {
height: 50px;
border-radius: 0;
border: none;
width: 700px;
box-shadow: none;
outline: none;
}
.navbar.navbar-custom .btn.btn-search {
height: 50px;
border-radius: 0;
border: none;
background: grey;
color: white;
}
.navbar.navbar-custom .btn.btn-upload {
float: 0;
height: 50px;
border-radius: 0;
border: none;
background: #a94442;
color: white;
}
.navbar.navbar-custom .navbar-header .navbar-toggle,
.navbar.navbar-custom .navbar-header .navbar-toggle:hover,
.navbar.navbar-custom .navbar-header .navbar-toggle:focus {
background: none;
border: none;
}
.navbar.navbar-custom .navbar-header span.icon-bar {
background: #444;
}
#media (min-width: 768px) {
.navbar.navbar-custom {
height: 50px;
}
}
#media (max-width: 992px) {
.navbar.navbar-custom .form-search .search-box {
width: 500px;
}
}
#media (max-width: 767px) {
.navbar.navbar-custom .form-search {
right: 70px;
}
.navbar.navbar-custom .form-search .search-box {
width: 225px;
}
}
#media (max-width: 480px) {
.navbar.navbar-custom .navbar-brand {
display: none;
}
.navbar.navbar-custom .form-search .search-box {
width: 70%;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-nav" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span>
</button> <a class="navbar-brand" href="#">HELLO</a>
</div>
<div class="collapse navbar-collapse" id="bs-nav">
<ul class="nav navbar-nav">
<li>Home
</li>
</ul>
</div>
</div>
<form class="form-search">
<div class="input-group"> <span class="input-group"> <span class="input-group-btn" role="group" aria-label="...">
<button type="button" href="#myModal" data-toggle="modal" class="btn btn-upload">Upload</button>
</span>
<input type="text" class="form-control search-box" placeholder="Search"> <span class="input-group-btn" role="group" aria-label="...">
<button type="button" class="btn btn-search"><i class="fa fa-search"></i></button>
</span> </span>
</div>
</form>
</nav>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Submit</h4>
</div>
<!-- end modal-header -->
<div class="modal-body"> <small class="text-muted">Tell us</small>
<form action="forms.php" method="post" class="form-horizontal">
<label for="name" name="name">Name</label>
<input class="form-control" name="name" placeholder="Name" type="text">
<br>
<label for="yourStory" name="yourStory">Your Tell All</label>
<textarea class="form-control" name="yourStory" placeholder="Tell us your story" rows="3"></textarea>
<br>
<label for="inputFile">File input</label>
<input type="file" name="inputfile" id="inputFile">
<br>
<button name="submit" class="btn btn-success active" type="submit">Submit</button>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" type="button">Close</button>
<button class="btn btn-primary" type="button">Save changes</button>
</div>
</div>
</div>
</div>
<!-- end myModal -->
<div class="container">
<div class="alert alert-info">Yo</div>
</div>

Bootstrap input-groups within navbar

I'm trying to solve the various issues with Bootstrap input-group placed inside navbar. The formatting http://bootply.com/101777
<div class="container">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<span class="navbar-brand">Game</span>
</div>
<form class="navbar-form navbar-left itg-game">
<div class="form-group itg-first">
<div class="input-group">
<span class="input-group-addon" ng-bind="first.name"></span>
<input type="text" class="form-control" readonly ng-model="first.value">
</div>
</div>
<div class="form-group">
<div class="btn-group itg-action">
<button ng-click="swap()" class="btn btn-default itg-action-btn" ng-bind="text"></button>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href ng-click="resetGame()">Reset game</a></li>
</ul>
</div>
</div>
<div class="form-group itg-second">
<div class="input-group">
<input type="text" class="form-control" readonly ng-model="second.value">
<span class="input-group-addon" ng-bind="second.name"></span>
</div>
</div>
<div class="form-group itg-fee">
<div class="input-group">
<input type="text" class="form-control" readonly ng-model="fee">
<span class="input-group-addon">fee</span>
</div>
</div>
</form>
</nav>
</div>
And the styles:
#media (min-width: 768px) {
.itg-game { }
.itg-game .itg-first, .itg-game .itg-second { width: 12em; }
.itg-game .itg-fee { width: 8em; }
.itg-game .itg-action { text-align: center; }
.itg-game .itg-action .itg-action-btn { width: 15em; }
}
There are two issues:
The mobile view (less than 768px) is completely rubbish - lines overlaps the borders of the navbar, controls stick to the borders.
mid-size version is better but for some reason the third input jumps to the third line.
It looks like the input-groups are not compatible with navbars. Am I right?
They work fine with the navbar with a minimal amount of fiddling with the css, but you can't have it set up like you have it because the size matters. Input groups are display:table and 100% width, they need a col-. If you had too many links or links with really long names, your navbar would break down crappily.
DEMO http://jsbin.com/putuki/1/edit
<div class="navbar navbar-default navbar-static-top my-navbar">
<button class="navbar-toggle visible-xs" data-target=".navbar-collapse" data-toggle="collapse" type="button"><span class="sr-only">Toggle navigation</span> <span class="icon-bar"><!--empty--></span> <span class="icon-bar"><!--empty--></span> <span class="icon-bar"><!--empty--></span></button>
<div class="container visible-xs">
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="navbar-collapse collapse" id="mynavcollapse">
<div class="container">
<div class="row">
<form>
<div class="col-sm-2 hidden-xs">
<a class="navbar-brand" href="#">Project name</a>
</div>
<div class="col-sm-2">
<div class="input-group">
<input class='form-control' placeholder="Search: (stuff)" type='text'> <span class="input-group-btn"><button class="btn btn-default">Button</button></span>
</div><!-- /input-group -->
</div><!-- /col- -->
<div class="col-sm-2">
<div class="input-group">
<input class='form-control' placeholder="Search: (stuff)" type='text'> <span class="input-group-btn"><button class="btn btn-default">Button</button></span>
</div><!-- /input-group -->
</div><!-- /col- -->
<div class="col-sm-3">
<div class="input-group">
<input class='form-control' placeholder="Search: (stuff)" type='text'> <span class="input-group-btn"><button class="btn btn-default">Button</button></span>
</div><!-- /input-group -->
</div><!-- /col- -->
<div class="col-sm-3">
<div class="input-group">
<input class='form-control' placeholder="Search: (stuff)" type='text'> <span class="input-group-btn"><button class="btn btn-default">Button</button></span>
</div><!-- /input-group -->
</div><!-- /col- -->
</form>
</div>
</div>
</div>
</div>
CSS
.my-navbar .row [class*="col-"] {
margin-top: 10px
}
#mynavcollapse {
clear: both;
padding: 0 0 10px;
background: #eee;
}
#media (min-width: 768px) {
.my-navbar .navbar-brand {
float: none;
display: inline-block;
padding: 7px 0 0 0;
}
.my-navbar .row {
margin-left: -.5%;
margin-right: -.5%;
}
.my-navbar .row [class*="col-"] {
min-height: 1px;
padding-left: .5%;
padding-right: .5%;
padding-top: 10px;
margin-top: 0;
}
}