html - Lables get overlapped and aligned to the right -
i using latest version of bootstrap create search box. search has dropdown before search button.
clicking on dropdown brings bunch of controls.
here's mark it.
<div class="row"> <div class="col-md-12"> <div class="input-group" id="adv-search"> <input type="text" class="form-control" placeholder="search snippets" /> <div class="input-group-btn"> <div class="btn-group" role="group"> <div class="dropdown dropdown-lg"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><span class="caret"></span></button> <div class="dropdown-menu dropdown-menu-right" role="menu"> <form class="form-horizontal" role="form"> <div class="form-group"> <label for="filter">filter by</label> <select class="form-control"> <option value="0" selected>all snippets</option> <option value="1">featured</option> <option value="2">most popular</option> <option value="3">top rated</option> <option value="4">most commented</option> </select> </div> <div class="form-group"> <label for="contain">author</label> <input class="form-control" type="text" /> </div> <div class="form-group"> <label for="contain">contains words</label> <input class="form-control" type="text" /> </div> <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> </form> </div> </div> <button type="button" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> </div> </div> </div> </div> </div>
css
/* search box */ .dropdown.dropdown-lg .dropdown-menu { margin-top: -1px; padding: 6px 20px; } .input-group-btn .btn-group { display: flex !important; } .btn-group .btn { border-radius: 0; margin-left: -1px; } .btn-group .btn:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; } .btn-group .form-horizontal .btn[type="submit"] { border-top-left-radius: 4px; border-bottom-left-radius: 4px; } .form-horizontal .form-group { margin-left: 0; margin-right: 0; } .form-group .form-control:last-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; } @media screen , (min-width: 768px) { #adv-search { width: 500px; margin: 0 auto; } .dropdown.dropdown-lg { position: static !important; } .dropdown.dropdown-lg .dropdown-menu { min-width: 500px; } }
the issue label controls 'author' getting aligned right seen here:
the author label should come under dropdown. doing wrong?
p.s: ignore text in red control under searchbox.
label tags display inline elements default. is, want stay on same line content around them. change add display:block labels want force new line. or wrap them in own personal div tag.
i added
label{ display:block; }
to css demonstrate.
https://jsfiddle.net/blfv9dh6/
note: there more css things going on though. think there may ' float:left ' values being used somewhere. can mess if not cleared css property clear.
label{ clear:both; } http://www.w3schools.com/cssref/pr_class_clear.asp
(ps veterans, don't spam me w3schools. no not perfect. it's handy beginners).
Comments
Post a Comment