As you can see in the code below, when I resize window size, the image doesn't scale with it. I don't want to make the image distort when I resize the window. I want to make it so the image center is always in the middle of the window. Like on the phone I don't need to see the blue and red parts of the image just the center logo in middle and according to so with window resize until its full screen with full hero image in view. How do I do this? I can't really find any documentation with bootstrap.
input{
border: none;
border-bottom: 2px solid white;
}
::placeholder {
color: white
}
input[type=text] {
width: 36%;
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
background-color: transparent;
color: white !important;
}
input[type=text]:focus {
width: 50%;
background-color: transparent;
color: white !important;
}
.bg-primary {
background-color: #000000 !important;
}
.custom-toggler .navbar-toggler-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255, 1)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E");
}
.navbar-nav .open .dropdown-menu {
color: white
}
.navbar {
background-color: #000000;
}
.navbar .navbar-brand {
color: #ffffff;
}
.navbar .navbar-brand:hover,
.navbar .navbar-brand:focus {
color: #ededed;
}
.navbar .navbar-text {
color: #ffffff;
}
.navbar .navbar-text a {
color: #ededed;
}
.navbar .navbar-text a:hover,
.navbar .navbar-text a:focus {
color: #ededed;
}
.navbar .navbar-nav .nav-link {
color: #ffffff;
border-radius: .25rem;
margin: 0 0.25em;
}
.navbar .navbar-nav .nav-link:not(.disabled):hover,
.navbar .navbar-nav .nav-link:not(.disabled):focus {
color: #ededed;
}
.navbar .navbar-nav .dropdown-menu {
background-color: #000000;
border-color: #000000;
}
.navbar .navbar-nav .dropdown-menu .dropdown-item {
color: #ffffff;
}
.navbar .navbar-nav .dropdown-menu .dropdown-item:hover,
.navbar .navbar-nav .dropdown-menu .dropdown-item:focus,
.navbar .navbar-nav .dropdown-menu .dropdown-item.active {
color: #ededed;
background-color: #000000;
}
.navbar .navbar-nav .dropdown-menu .dropdown-divider {
border-top-color: #000000;
}
.navbar .navbar-nav .nav-item.active .nav-link,
.navbar .navbar-nav .nav-item.active .nav-link:hover,
.navbar .navbar-nav .nav-item.active .nav-link:focus,
.navbar .navbar-nav .nav-item.show .nav-link,
.navbar .navbar-nav .nav-item.show .nav-link:hover,
.navbar .navbar-nav .nav-item.show .nav-link:focus {
color: #ededed;
background-color: #000000;
}
.navbar .navbar-toggle {
border-color: #000000;
}
.navbar .navbar-toggle:hover,
.navbar .navbar-toggle:focus {
background-color: #000000;
}
.navbar .navbar-toggle .navbar-toggler-icon {
color: #ffffff;
}
.navbar .navbar-collapse,
.navbar .navbar-form {
border-color: #ffffff;
}
.navbar .navbar-link {
color: #ffffff;
}
.navbar .navbar-link:hover {
color: #ededed;
}
#media (max-width: 575px) {
.navbar-expand-sm .navbar-nav .show .dropdown-menu .dropdown-item {
color: #ffffff;
}
.navbar-expand-sm .navbar-nav .show .dropdown-menu .dropdown-item:hover,
.navbar-expand-sm .navbar-nav .show .dropdown-menu .dropdown-item:focus {
color: #ededed;
}
.navbar-expand-sm .navbar-nav .show .dropdown-menu .dropdown-item.active {
color: #ededed;
background-color: #000000;
}
}
#media (max-width: 767px) {
.navbar-expand-md .navbar-nav .show .dropdown-menu .dropdown-item {
color: #ffffff;
}
.navbar-expand-md .navbar-nav .show .dropdown-menu .dropdown-item:hover,
.navbar-expand-md .navbar-nav .show .dropdown-menu .dropdown-item:focus {
color: #ededed;
}
.navbar-expand-md .navbar-nav .show .dropdown-menu .dropdown-item.active {
color: #ededed;
background-color: #000000;
}
}
#media (max-width: 991px) {
.navbar-expand-lg .navbar-nav .show .dropdown-menu .dropdown-item {
color: #ffffff;
}
.navbar-expand-lg .navbar-nav .show .dropdown-menu .dropdown-item:hover,
.navbar-expand-lg .navbar-nav .show .dropdown-menu .dropdown-item:focus {
color: #ededed;
}
.navbar-expand-lg .navbar-nav .show .dropdown-menu .dropdown-item.active {
color: #ededed;
background-color: #000000;
}
}
#media (max-width: 1199px) {
.navbar-expand-xl .navbar-nav .show .dropdown-menu .dropdown-item {
color: #ffffff;
}
.navbar-expand-xl .navbar-nav .show .dropdown-menu .dropdown-item:hover,
.navbar-expand-xl .navbar-nav .show .dropdown-menu .dropdown-item:focus {
color: #ededed;
}
.navbar-expand-xl .navbar-nav .show .dropdown-menu .dropdown-item.active {
color: #ededed;
background-color: #000000;
}
}
.navbar-expand .navbar-nav .show .dropdown-menu .dropdown-item {
color: #ffffff;
}
.navbar-expand .navbar-nav .show .dropdown-menu .dropdown-item:hover,
.navbar-expand .navbar-nav .show .dropdown-menu .dropdown-item:focus {
color: #ededed;
}
.navbar-expand .navbar-nav .show .dropdown-menu .dropdown-item.active {
color: #ededed;
background-color: #000000;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="styles.css">
<title>(Insert Name) Reviews)</title>
<link rel="icon" type="image/png" sizes="100x100" href="https://moundspet.com/wp-content/uploads/2017/03/Placeholder-1.png">
</head>
<body>
<nav class="navbar navbar-expand-lg">
<a class="navbar-brand" href="index.html"> <img alt="logo" src="https://moundspet.com/wp-content/uploads/2017/03/Placeholder-1.png" width="30" height="30"></a>
<input class="mr-auto" type="text" name="search" placeholder="Search...">
<button class="navbar-toggler custom-toggler" type="button" data-toggle="collapse" data-target="#collapse"
aria-controls="collapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapse">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#">Sign Up</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Login</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<img class="img-responsive" alt="background" src="https://i.imgur.com/I47YLUI.jpg" style="width:1536px;height:600px;">
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
crossorigin="anonymous"></script>
</body>
You can use img-fluid class on image tag that will scale the image as per devices and remove custom CSS on image
bootstrap - responsive-images
Related
I am trying to create a navbar with a grid inside of it. I need to have the text appear on one line. As you can see from this screenshot, "Cryptocurrencies / Markets" and "Market Cap" and volume take up multiple lines. I want the text to only take up one line. See attached screenshot:
I've tried changing the col-sm-x classes but no luck. I can't get everything to line up on one line. Any suggestions? Thanks.
<html>
<head>
<title>#yield('meta_title') | #lang('constants.WEBSITE_NAME')</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<style type="text/css">
/* navbar */
.navbar-default {
background-color: #337ab7;
border-color: #E7E7E7;
}
/* Title */
.navbar-default .navbar-brand {
color: #777;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #5E5E5E;
}
/* Link */
.navbar-default .navbar-nav > li > a {
color: #777;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #333;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #555;
background-color: #E7E7E7;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #555;
background-color: #D5D5D5;
}
/* Caret */
.navbar-default .navbar-nav > .dropdown > a .caret {
border-top-color: #777;
border-bottom-color: #777;
}
.navbar-default .navbar-nav > .dropdown > a:hover .caret,
.navbar-default .navbar-nav > .dropdown > a:focus .caret {
border-top-color: #333;
border-bottom-color: #333;
}
.navbar-default .navbar-nav > .open > a .caret,
.navbar-default .navbar-nav > .open > a:hover .caret,
.navbar-default .navbar-nav > .open > a:focus .caret {
border-top-color: #555;
border-bottom-color: #555;
}
/* Mobile version */
.navbar-default .navbar-toggle {
border-color: #DDD;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #DDD;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #CCC;
}
#media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #777;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #333;
}
}
.navbar-top {
padding-left:150px;
font-size:10px;
}
</style>
</head>
<body>
<nav class="navbar mobile navbar-default visible-xs">
<div class="navbar-header navbar-top">
<div class="container-fluid">
<div class="row">
<div class="col-sm-4" style="color:#fff"><strong>Cryptocurrencies</strong> 1000 / Markets 1000</div>
<div class="col-sm-5" style="color:#fff">
<strong>Market Cap</strong>:$263,920,404,123 <strong>24h Vol</strong>:$15,360,994,812
</div>
<div class="col-sm-3">
<button type="button" class="btn btn-info btn-sm">Submit ICO</button>
<button type="button" class="btn btn-info btn-sm">Login</button>
</div>
</div>
</div>
</div>
</nav>
</body>
<html>
You may also want to include a width and margin on that div...
.navbar-top {
padding-left: 150px;
font-size: 10px;
white-space: nowrap;
width: 92%;
margin: 0 auto;
}
And on your .row div add align-items-center
<div class="row align-items-center">
...
</div>
How do I center both the brand and the navbar in bootstrap. Also how can I have the navbar stop around the brand and links, ie wraps around content and navbar and not stretch across the entire page. Please take a look at the css I just added
.navbar-default {
background-color: #395085;
border-color: #2a3858;
}
.navbar-default .navbar-brand {
color: #dcdcdc;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #ffffff;
}
.navbar-default .navbar-text {
color: #dcdcdc;
}
.navbar-default .navbar-nav > li > a {
color: #dcdcdc;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #ffffff;
}
.navbar-default .navbar-nav > li > .dropdown-menu {
background-color: #395085;
}
.navbar-default .navbar-nav > li > .dropdown-menu > li > a {
color: #dcdcdc;
}
.navbar-default .navbar-nav > li > .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav > li > .dropdown-menu > li > a:focus {
color: #ffffff;
background-color: #2a3858;
}
.navbar-default .navbar-nav > li > .dropdown-menu > li.divider {
background-color: #2a3858;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #ffffff;
background-color: #2a3858;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #ffffff;
background-color: #2a3858;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #ffffff;
background-color: #2a3858;
}
.navbar-default .navbar-toggle {
border-color: #2a3858;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #2a3858;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #dcdcdc;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #dcdcdc;
}
.navbar-default .navbar-link {
color: #dcdcdc;
}
.navbar-default .navbar-link:hover {
color: #ffffff;
}
.navbar-brand {
background-size: 1
^% auto;
background-repeat: no-repeat;
margin-right: 0px;
background-clip: padding-box;
}
.container-fluid .row .col-lg-offset-1.col-lg-5 {
margin-top: 5px;
}
#media (max-width:649px){
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #dcdcdc;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffffff;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #ffffff;
background-color: #2a3858;
}
.navbar-toggle {
color: #FFFFFF;
}
}
#mid_title {
font-size: 24px;
line-height: 24px;
font-weight: 400;
color: #fff;
margin-bottom: 10px; /* text-shadow: 2px 2px 4px #000 */;
}
#middle_wrapper {
clear: both;
padding: 40px 15px 0;
overflow: hidden;
font-size: 14px;
color: #f4e9d9;
background: url(/images/templatemo_middle.jpg) center top;
}
.col_allw300 {
float: left;
}
.templatemo_text {
color: #08122a;
font-weight: normal;
text-decoration: none;
}
.lower_specs {
background-color: #BFC5CE;
}
.sb_news_box {
clear: both;
margin-bottom: 17px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Electro-Tech Inc</title>
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/etp.css" rel="stylesheet" type="text/css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-default">
<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="#defaultNavbar1"><span class="sr-only">Toggle navigation</span>Menu <span class="glyphicon glyphicon-chevron-down"></span></button>
<a class="navbar-brand" href="about.html">Electrotech</a></div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="defaultNavbar1">
<ul class="nav navbar-nav justify-content-center">
<li>About Us</li>
<li>Industries</li>
<li>Products</li>
<li>News</li>
<li>Gallery</li>
<li>Contact Us</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery-1.11.2.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.js"></script>
</body>
</html>
You could set .navbar to have the CSS style text-align: center, then set .navbar-header and .navbar-collapse to display: inline-block. This way your elements are still block elements, but they flow like inline elements.
Here is a fiddle. Note the media query so you keep default Bootstrap responsive menu behavior.
I'm beginner with CSS and Boostrap.
I want to add button to the left side of my list, but it overlaps with the item below it when I set float:left. It overlaps with the following green item. I tried pull-left text-left class but they didn't work.
I hope Anyone can help me to fix it?
here is picture in my browser :
here is my html code:
body{
background:#f4f4f4;
}
#font-face {
font-family: 'Google';
src: url('/fonts/Google.eot?#') format('eot'), /* IE6–8 */
url('/fonts/Google.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('/fonts/Google.ttf') format('truetype'); /* Saf3—5, Chrome4+, FF3.5, Opera 10+ */
}
*{
font-family: Google, Arial, Helvetica, sans-serif;
direction: rtl;
}
/* Navbar */
.navbar{
min-height: 33px !important;
margin-bottom:0;
border-radius:0;
}
.navbar-nav > li > a, .navbar-brand{
padding-top:6px !important;
padding-bottom:0 !important;
height: 33px;
}
.navbar-default {
background-color: #e74c3c;
border-color: #c0392b;
}
.navbar-default .navbar-brand {
color: #ecf0f1;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #ffbbbc;
}
.navbar-default .navbar-text {
color: #ecf0f1;
}
.navbar-default .navbar-nav > li > a {
color: #ecf0f1;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #ffbbbc;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
.navbar-default .navbar-toggle {
border-color: #c0392b;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #c0392b;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #ecf0f1;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #ecf0f1;
}
.navbar-default .navbar-link {
color: #ecf0f1;
}
.navbar-default .navbar-link:hover {
color: #ffbbbc;
}
/* Custom */
.main-color-bg{
background-color: #e74c3c !important;
border-color: #c0392b !important;
color:#ffffff !important;
}
/* Header */
#header{
background:#333333;
color:#ffffff;
padding-bottom: 10px;
margin-bottom: 15px;
}
#header .create{
padding-top: 20px;
}
/* Breadcrumb */
.breadcrumb{
background:#cccccc;
color:#333333;
}
.breadcrumb a{
color:#333333;
}
.dash-box{
text-align:center;
}
#login{
margin-top:30px;
}
/* Footer */
#footer{
background:#333333;
color:#ffffff;
text-align:center;
padding:30px;
margin-top:30px;
}
#media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ecf0f1;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffbbbc;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
}
.loginlink{
margin-top:10px;
padding-top:10px;
}
.linkcolorfont{
color: #000000;
text-decoration: none;
}
a:hover{
text-decoration: none;
color: #555555;
}
img {
display: block;
margin: 0 auto;
}
#media only screen and (min-width: 992px) {
.sort-right {
float: right!important;
}
}
.ltr {
direction: LTR;
}
.bg-green{
background-color: #5cb85c;
color: #fff;
}
.run-success{
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
#addcredit{
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-3 sort-right">
<div class="list-group">
<div href="index.html" class="list-group-item active main-color-bg">اطلاعات > shikkhooneh</div>
<div class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> دنبال کنندگان : 2598</div>
<div class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> دنبال شوندگان : 1420</div>
<div class="list-group-item"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> اعتبار : 206<button class="btn btn-default" style="float:left"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> توقف</button></div>
<div class="run-success list-group-item "><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> وضعیت : اجرا</div>
<div class="list-group-item"><small><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> اطلاعات درج شده ممکن است بروز نباشد.</small></div>
<div class="list-group-item"><button class="btn btn-default center-block"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> توقف</button></div>
</div>
</div>
I would use a flexbox for .list-group-item and set the right margin for the button to auto. This also allows for easy and perfect vertical alignment.
body{
background:#f4f4f4;
}
#font-face {
font-family: 'Google';
src: url('/fonts/Google.eot?#') format('eot'), /* IE6–8 */
url('/fonts/Google.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('/fonts/Google.ttf') format('truetype'); /* Saf3—5, Chrome4+, FF3.5, Opera 10+ */
}
*{
font-family: Google, Arial, Helvetica, sans-serif;
direction: rtl;
}
/* Navbar */
.navbar{
min-height: 33px !important;
margin-bottom:0;
border-radius:0;
}
.navbar-nav > li > a, .navbar-brand{
padding-top:6px !important;
padding-bottom:0 !important;
height: 33px;
}
.navbar-default {
background-color: #e74c3c;
border-color: #c0392b;
}
.navbar-default .navbar-brand {
color: #ecf0f1;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #ffbbbc;
}
.navbar-default .navbar-text {
color: #ecf0f1;
}
.navbar-default .navbar-nav > li > a {
color: #ecf0f1;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #ffbbbc;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
.navbar-default .navbar-toggle {
border-color: #c0392b;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #c0392b;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #ecf0f1;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #ecf0f1;
}
.navbar-default .navbar-link {
color: #ecf0f1;
}
.navbar-default .navbar-link:hover {
color: #ffbbbc;
}
/* Custom */
.main-color-bg{
background-color: #e74c3c !important;
border-color: #c0392b !important;
color:#ffffff !important;
}
/* Header */
#header{
background:#333333;
color:#ffffff;
padding-bottom: 10px;
margin-bottom: 15px;
}
#header .create{
padding-top: 20px;
}
/* Breadcrumb */
.breadcrumb{
background:#cccccc;
color:#333333;
}
.breadcrumb a{
color:#333333;
}
.dash-box{
text-align:center;
}
#login{
margin-top:30px;
}
/* Footer */
#footer{
background:#333333;
color:#ffffff;
text-align:center;
padding:30px;
margin-top:30px;
}
#media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ecf0f1;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffbbbc;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
}
.loginlink{
margin-top:10px;
padding-top:10px;
}
.linkcolorfont{
color: #000000;
text-decoration: none;
}
a:hover{
text-decoration: none;
color: #555555;
}
img {
display: block;
margin: 0 auto;
}
#media only screen and (min-width: 992px) {
.sort-right {
float: right!important;
}
}
.ltr {
direction: LTR;
}
.bg-green{
background-color: #5cb85c;
color: #fff;
}
.run-success{
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
.list-group-item {
display: flex !important;
justify-content: flex-start;
align-items: center;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-3 sort-right">
<div class="list-group">
<div href="index.html" class="list-group-item active main-color-bg">اطلاعات > shikkhooneh</div>
<div class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> دنبال کنندگان : 2598</div>
<div class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> دنبال شوندگان : 1420</div>
<div class="list-group-item"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> اعتبار : 206<button class="btn btn-default" style="margin-right: auto;"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> توقف</button></div>
<div class="run-success list-group-item "><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> وضعیت : اجرا</div>
<div class="list-group-item"><small><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> اطلاعات درج شده ممکن است بروز نباشد.</small></div>
<div class="list-group-item"><button class="btn btn-default center-block"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> توقف</button></div>
</div>
</div>
You need to use overflow:hidden; inside that parent class
body{
background:#f4f4f4;
}
#font-face {
font-family: 'Google';
src: url('/fonts/Google.eot?#') format('eot'), /* IE6–8 */
url('/fonts/Google.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('/fonts/Google.ttf') format('truetype'); /* Saf3—5, Chrome4+, FF3.5, Opera 10+ */
}
*{
font-family: Google, Arial, Helvetica, sans-serif;
direction: rtl;
}
/* Navbar */
.navbar{
min-height: 33px !important;
margin-bottom:0;
border-radius:0;
}
.navbar-nav > li > a, .navbar-brand{
padding-top:6px !important;
padding-bottom:0 !important;
height: 33px;
}
.navbar-default {
background-color: #e74c3c;
border-color: #c0392b;
}
.navbar-default .navbar-brand {
color: #ecf0f1;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #ffbbbc;
}
.navbar-default .navbar-text {
color: #ecf0f1;
}
.navbar-default .navbar-nav > li > a {
color: #ecf0f1;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #ffbbbc;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
.navbar-default .navbar-toggle {
border-color: #c0392b;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #c0392b;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #ecf0f1;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #ecf0f1;
}
.navbar-default .navbar-link {
color: #ecf0f1;
}
.navbar-default .navbar-link:hover {
color: #ffbbbc;
}
/* Custom */
.main-color-bg{
background-color: #e74c3c !important;
border-color: #c0392b !important;
color:#ffffff !important;
}
/* Header */
#header{
background:#333333;
color:#ffffff;
padding-bottom: 10px;
margin-bottom: 15px;
}
#header .create{
padding-top: 20px;
}
/* Breadcrumb */
.breadcrumb{
background:#cccccc;
color:#333333;
}
.breadcrumb a{
color:#333333;
}
.dash-box{
text-align:center;
}
#login{
margin-top:30px;
}
/* Footer */
#footer{
background:#333333;
color:#ffffff;
text-align:center;
padding:30px;
margin-top:30px;
}
#media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ecf0f1;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffbbbc;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
}
.loginlink{
margin-top:10px;
padding-top:10px;
}
.linkcolorfont{
color: #000000;
text-decoration: none;
}
a:hover{
text-decoration: none;
color: #555555;
}
img {
display: block;
margin: 0 auto;
}
#media only screen and (min-width: 992px) {
.sort-right {
float: right!important;
}
}
.ltr {
direction: LTR;
}
.bg-green{
background-color: #5cb85c;
color: #fff;
}
.run-success{
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
#addcredit{
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="col-md-3 sort-right">
<div class="list-group">
<div href="index.html" class="list-group-item active main-color-bg">اطلاعات > shikkhooneh</div>
<div class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> دنبال کنندگان : 2598</div>
<div class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> دنبال شوندگان : 1420</div>
<div class="list-group-item" style="overflow:hidden;"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> اعتبار : 206<button class="btn btn-default" style="float:left"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> توقف</button></div>
<div class="run-success list-group-item "><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> وضعیت : اجرا</div>
<div class="list-group-item"><small><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> اطلاعات درج شده ممکن است بروز نباشد.</small></div>
<div class="list-group-item"><button class="btn btn-default center-block"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> توقف</button></div>
</div>
</div>
Maybe you can try tu use an absolute position on your button.
.btn {
position: absolute;
left: 10px;
top: 50%;
transform: translateY(-50%);
width: XXXX;
height: XXXX;
}
And so you have to use relative position on the parent
.list-group-item {
position: relative;
width: XXXX;
height: XXXX;
}
Please check this. i use .sort-right .list-group-item{float:left; width:100%;}.
body{
background:#f4f4f4;
}
#font-face {
font-family: 'Google';
src: url('/fonts/Google.eot?#') format('eot'), /* IE6–8 */
url('/fonts/Google.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/
url('/fonts/Google.ttf') format('truetype'); /* Saf3—5, Chrome4+, FF3.5, Opera 10+ */
}
*{
font-family: Google, Arial, Helvetica, sans-serif;
direction: rtl;
}
/* Navbar */
.navbar{
min-height: 33px !important;
margin-bottom:0;
border-radius:0;
}
.navbar-nav > li > a, .navbar-brand{
padding-top:6px !important;
padding-bottom:0 !important;
height: 33px;
}
.navbar-default {
background-color: #e74c3c;
border-color: #c0392b;
}
.navbar-default .navbar-brand {
color: #ecf0f1;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #ffbbbc;
}
.navbar-default .navbar-text {
color: #ecf0f1;
}
.navbar-default .navbar-nav > li > a {
color: #ecf0f1;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #ffbbbc;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
.navbar-default .navbar-toggle {
border-color: #c0392b;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #c0392b;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #ecf0f1;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #ecf0f1;
}
.navbar-default .navbar-link {
color: #ecf0f1;
}
.navbar-default .navbar-link:hover {
color: #ffbbbc;
}
/* Custom */
.main-color-bg{
background-color: #e74c3c !important;
border-color: #c0392b !important;
color:#ffffff !important;
}
/* Header */
#header{
background:#333333;
color:#ffffff;
padding-bottom: 10px;
margin-bottom: 15px;
}
#header .create{
padding-top: 20px;
}
/* Breadcrumb */
.breadcrumb{
background:#cccccc;
color:#333333;
}
.breadcrumb a{
color:#333333;
}
.dash-box{
text-align:center;
}
#login{
margin-top:30px;
}
/* Footer */
#footer{
background:#333333;
color:#ffffff;
text-align:center;
padding:30px;
margin-top:30px;
}
#media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ecf0f1;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffbbbc;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #ffbbbc;
background-color: #c0392b;
}
}
.loginlink{
margin-top:10px;
padding-top:10px;
}
.linkcolorfont{
color: #000000;
text-decoration: none;
}
a:hover{
text-decoration: none;
color: #555555;
}
img {
display: block;
margin: 0 auto;
}
#media only screen and (min-width: 992px) {
.sort-right {
float: right!important;
}
}
.ltr {
direction: LTR;
}
.bg-green{
background-color: #5cb85c;
color: #fff;
}
.run-success{
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
#addcredit{
}
.sort-right .list-group-item{float:left; width:100%;}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<div class="col-md-3 sort-right">
<div class="list-group">
<div href="index.html" class="list-group-item active main-color-bg">اطلاعات > shikkhooneh</div>
<div class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> دنبال کنندگان : 2598</div>
<div class="list-group-item"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> دنبال شوندگان : 1420</div>
<div class="list-group-item"><span class="glyphicon glyphicon-usd" aria-hidden="true"></span> اعتبار : 206<button class="btn btn-default" style="float:left"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> توقف</button></div>
<div class="run-success list-group-item "><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> وضعیت : اجرا</div>
<div class="list-group-item"><small><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> اطلاعات درج شده ممکن است بروز نباشد.</small></div>
<div class="list-group-item"><button class="btn btn-default center-block"><span class="glyphicon glyphicon-pause" aria-hidden="true"></span> توقف</button></div>
</div>
</div>
I'm currently working with a bootstrap navbar but i want to style my dropdown,
I have a "Hamburger" styled dropdown button and my current dropdown looks like this: http://prntscr.com/ctocj2 What i need to do is to style the dropdown. What i'm trying to accomplish is this
body {
margin: 0;
padding: 0;
background-color: lightgrey;
}
.navbar-default {
font-family: "Arial Rounded MT";
font-weight: bold;
font-size: 20px;
position: relative;
background-color: white;
box-shadow: 20px;
padding: 30px;
border: none;
}
.navbar-header {
right: auto;
}
.navbar-nav > li {} .navbar-default .navbar-brand,
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: black;
font-size: 30px;
}
.navbar-default .navbar-nav > li > a {
color: #3E6AAF;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #0042a5;
opacity: 0.5;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #3E6AAF;
background-color: transparent;
}
.navbar-default .navbar-text {
color: #FFF;
}
.navbar-default .navbar-toggle {
background-color: transparant;
border: none;
}
.navbar-toggle .icon-bar {
height: 8px;
width: 50px;
border-radius: 10px;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: ;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #3E6AAF;
border: none;
}
.col-md-5 {
font-family: "Lato-Bold";
padding: 10px;
color: white;
font-size: 20px;
}
.col-md-12 {
font-family: "Lato-Bold";
height: 520px;
padding: 10px;
color: white;
}
.navbar-collapse {
border: 0px;
}
.navbar-default .navbar-collapse {
color: #e7e7e7;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: transparent;
box-shadow: none;
}
.dropdown-menu {
background-color: transparent;
;
text-decoration-color: black;
}
.dropdown-toggle {
background-color: transparent;
color: black;
}
.navbar-default .navbar-nav .open .dropdown-menu>li>a,
.navbar-default .navbar-nav .open .dropdown-menu {
background-color: black;
color: white;
}
.navbar-right {
padding-right: 100px;
}
.navbar-brand {
position: relative;
right: 15%;
display: block;
padding-top: -100px;
width: 50%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Niet beschikbaar</title>
<link rel="shortcut icon" href="img/favicon2.ico" type="image/x-icon">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"> </script>
</head>
<body>
<!-- NAVIGATIE BALK -->
<nav class="navbar navbar-default" role="navigation">
<!-- logo -->
<div class="navbar-header">
<!-- -->
<a class="pull-right navbar-brand" href="#">
<img src="img/LOGOBIRSKEN2.svg"/>
</a>
<button type="button" class="pull-left navbar-toggle" data-toggle="collapse" data-target="#mainnavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="mainnavbar">
<ul class="nav navbar-nav">
<li class="active">home</li>
<li>over</li>
<li>diensten</li>
<li>contact</li>
</ul>
</div>
</nav>
<div class="container-fluid">
</div>
I hope you guys can help me out.
Rainier
NOTE:
Its only for mobile
Rainier
bust this css in your style.css
#media (max-width:767px) {
.navbar-nav{ margin:0}
.navbar-nav>li>a{padding-top: 20px;padding-bottom: 20px; border-top:8px solid #406bad}
.navbar-nav>li:last-child>a{border-bottom:8px solid #406bad}
}
My navbar has 4 links all floating to the right. I used .pull-right to make it work. On mobile, I would like every link to move to the left except for my active link. I want my active link to stay right on all devices.
I'm trying to find the most efficient way to do this. Are there any classes within Bootstrap that can help with this or do I need to create a custom class for pulling the 3 links left on mobile?
HTML
<!-- Fixed Navbar -->
<nav class="navbar navbar-custom">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div> <!-- end navbar-header -->
<div id="navbar" class="collapse navbar-collapse pull-right">
<ul class="nav navbar-nav">
<li>Home</li>
<li>About Summit</li>
<li>Contact Us</li>
</ul>
<ul class="nav navbar-nav">
<li class="active">Client Login</li>
</ul>
</div><!--/.nav-collapse -->
</div> <!-- end container -->
</nav> <!-- end navbar navbar-custom -->
CSS
/*======= navbar ========*/
.navbar {
opacity: 0.95;
-webkit-opacity: 0.95;
-moz-opacity: 0.95;
filter: alpha(opacity=95); /* internet explorer */
}
#navbar > ul.nav a:hover {
color: #50b948; /*TD Green*/
}
.navbar-custom {
background-color: #f2f2f2;
font-family: 'Quicksand', sans-serif;
font-size: 1rem; /*14px*/
text-transform: uppercase;
font-weight: 700;
border: none;
}
.navbar-custom .navbar-brand {
color: #777;
}
.navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-brand:focus {
color: #5e5e5e;
background-color: transparent;
}
.navbar-custom .navbar-text {
color: #777;
}
.navbar-custom .navbar-nav > li > a {
color: #777;
}
.navbar-custom .navbar-nav > li > a:hover,
.navbar-custom .navbar-nav > li > a:focus {
color: #333;
background-color: transparent;
}
.navbar-custom .navbar-nav > .active > a {
background: #50b948;
color: #FAFAFA;
}
.navbar-custom .navbar-nav > .active > a:hover,
.navbar-custom .navbar-nav > .active > a:focus {
background: #FAFAFA;
-webkit-box-shadow: .5px .5px 4px 1px rgba(50,50,50,0.75);
-moz-box-shadow: .5px .5px 4px 1px rgba(50,50,50,0.75);
box-shadow: .5px .5px 4px 1px rgba(50,50,50,0.75);
}
.navbar-custom .navbar-nav > .disabled > a,
.navbar-custom .navbar-nav > .disabled > a:hover,
.navbar-custom .navbar-nav > .disabled > a:focus {
color: #ccc;
background-color: transparent;
}
.navbar-custom .navbar-toggle {
border-color: #ccc; /*btn border-color*/
}
.navbar-custom .navbar-toggle:hover,
.navbar-custom .navbar-toggle:focus {
background-color: #ddd; /*btn color on hover*/
}
.navbar-custom .navbar-toggle .icon-bar {
background-color: #888;
}
.navbar-custom .navbar-collapse,
.navbar-custom .navbar-form {
border-color: #ccc; /*collapsed bottom border color*/
}
.navbar-custom .navbar-nav > .open > a,
.navbar-custom .navbar-nav > .open > a:hover,
.navbar-custom .navbar-nav > .open > a:focus {
background-color: #e7e7e7;
color: #555;
}
#media (max-width: 767px) {
.navbar-custom .navbar-nav .open .dropdown-menu > li > a {
color: #777;
}
.navbar-custom .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-custom .navbar-nav .open .dropdown-menu > li > a:focus {
color: #333;
background-color: transparent;
}
.navbar-custom .navbar-nav .open .dropdown-menu > .active > a,
.navbar-custom .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-custom .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-custom .navbar-nav .open .dropdown-menu > .disabled > a,
.navbar-custom .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.navbar-custom .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #ccc;
background-color: transparent;
}
}
.navbar-custom .navbar-link {
color: #777;
}
.navbar-custom .navbar-link:hover {
color: #333;
}
.navbar-custom .btn-link {
color: #777;
}
.navbar-custom .btn-link:hover,
.navbar-custom .btn-link:focus {
color: #333;
}
.navbar-custom .btn-link[disabled]:hover,
fieldset[disabled] .navbar-custom .btn-link:hover,
.navbar-custom .btn-link[disabled]:focus,
fieldset[disabled] .navbar-custom .btn-link:focus {
color: #ccc;
}
The trick here will be to utilize the classes Bootstrap already adds for mobile and non-mobile.
Your div:
navbar-collapse collapse
Becomes:
navbar-collapse collapse in
When the slide down menu is opened on mobile. This means if your CSS applies to the class .navbar-collapse.in it will only apply to the open menu on mobile.
.navbar-collapse.in {
float: left !important;
}
Additionally, Bootstrap v4.0 (currently available but in alpha) contains the classes .pull-xs-left and .pull-sm-right, presumably for exactly this purpose.
Use '.navbar-right'. Specifically designed to move the nav to the right on desktop, but will move links back to the left when on mobile view.