jquery - How can you make buttons stretched only when the `navbar` is collapsed (Bootstrap)? -
jsfiddle, https://jsfiddle.net/4tusk977/.
<!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"> </head> <body> <div class="container-fluid"> <nav class="navbar navbar-default"> <div class="navbar-header"> <a class="navbar-brand" href="#">...</a> <button aria-expanded="false" class="collapsed navbar-toggle" data-target="#main_menu" data-toggle="collapse" type="button"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse" id="main_menu"> <form class="navbar-form navbar-right" id="main_menu_form" style="border: none;"> <input class="form-control" type="text" name="username" placeholder="user name"> <input class="form-control" type="password" name="password" placeholder="password"> <input class="btn btn-success" type="button" value="sign in"> <input class="btn btn-primary" type="button" value="sign up"> </form> </div> </nav> </div> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/bootstrap/dist/js/bootstrap.js"></script> </body> </html>
i want both sign in , sign buttons stretched equally when navigation bar collapsed. have tried using flex box, succeed, ruins layout when navigation bar not collapsed. should do?
you can use @media
css rule set values on selectors based on specific properties (like screen with).
@media screen , (max-width: 768px) { .navbar-collapse input[type="submit"] { width: 49%; } }
here jsfiddle:
https://jsfiddle.net/4tusk977/2/
wiki
Comments
Post a Comment