I'm trying to adjust the glyphicon-user icon and btn-primary in dropdown to be displayed properly when the window is resized. However, when I resize the window, my button alignment seems to be out of the window where I can't view the end of the button. Answers anyone?
<div class="container-fluid">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<strong>User</strong>
</a>
<ul id="user-dp" class="dropdown-menu">
<li>
<div class="row">
<!-- Login -->
<div class="col-lg-4">
<p class="text-center">
<span class="glyphicon glyphicon-user icon-size"></span>
</p>
</div>
<div class="col-lg-8">
<p class="text-left"><strong>Test</strong></p>
<p class="text-left">
Testing
</p>
</div>
<div class="bottom text-center">
Test again
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
style.css
.icon-size
{
margin-top:5%;
font-size: 87px;
}
#user-dp{
min-width: 300px;
padding: 14px 14px 0;
overflow:hidden;
background-color:rgba(255,255,255,.8);
}
#user-dp .help-block{
font-size:12px
}
#user-dp .bottom{
background-color:rgba(255,255,255,.8);
border-top:1px solid #ddd;
clear:both;
padding:14px;
}
Jamdev's answer is close, but it's your #user-dp that sets the min-width. This will keep your box 300px wide no matter the window size. By adding the following CSS, you will reset the min-width to 0 whenever your window is under 768px wide.
#media (max-width: 768px) {
#user-dp {
min-width:0;
}
}
Demo: http://www.bootply.com/GetuidWvdM
add this code into your custom.css #media (max-width: 767px) .navbar-nav .open .dropdown-menu { min-width:0; }
Related
I want to hide a telephone icon I've added when the browser is full screen desktop mode. I am using the template which is online here: https://sartre.thememountain.com/index-architecture-2.html
So far in mobile mode it looks ok. When I expand to full screen, the icon is floating in the corner. I want to hide fa-phone from view.
<header class="header header-fixed header-fixed-on-mobile header-transparent" data-bkg-threshold="100">
<div class="header-inner">
<div class="row nav-bar">
<div class="column width-12 nav-bar-inner">
<i class="fa fa-phone"></i>
<i class="far fa-envelope"></i>
<div class="logo">
<div class="logo-inner">
<img src="images/architecture/logo-dark.png" alt="Happy Kids Logo" />
<img src="images/architecture/logo-dark.png" alt="Happy Kids Logo" />
</div>
</div>
<nav class="navigation nav-block secondary-navigation nav-right">
<ul>
.fa-phone {
color:#000;
font-size:25px;
display:inline-block;
position: absolute;
left: 78%;
top:29%;
}
.fa-phone:fullscreen{
display: none
}
'''
#media only screen and (min-width: 768px) { /* For desktop: */ .fa-phone{ display: none; }
I have a simple side nav that I built out that I want fixed. From my understanding of bootstrap classes columns are supposed to be aligned. My second column for most of my page content ends up falling behind my sidenav. How do you have a second column aligned with your first while keeping that first column fixed?
#logo {
height: 40vh;
width: 20vw; }
.dropdown-toggle, .dropdown-menu {
width: 300px; }
.btn-group img {
margin-right: 10px; }
.dropdown-toggle {
padding-right: 50px; }
.dropdown-toggle .glyphicon {
margin-left: 20px;
margin-right: -40px; }
.dropdown-menu > li > a:hover {
background: white; }
/* $search-blue */
.dropdown-header {
background: #ccc;
font-size: 14px;
font-weight: 700;
padding-top: 5px;
padding-bottom: 5px;
margin-top: 10px;
margin-bottom: 5px; }
#sidebar {
min-width: 250px;
max-width: 250px;
height: 100vh;
border: 1px solid pink; }
/*# sourceMappingURL=notification.css.map */
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container-fluid" style="background-color: #e0f7fa">
<div class="d-flex flex-row" style="border:1px solid black;">
<div class="col d-flex justify-content-start" style="border:1px solid blue;">
<img id="logo" src="./images/logo.png">
</div><!--logo -->
<div class="col d-flex align-items-center justify-content-end" style="border:1px solid red;">
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img src="http://lorempixel.com/75/50/abstract/" style="border-radius: 50%;">
0123 4567 8912 3456
<span class="glyphicon glyphicon-chevron-down"></span>
</button>
<ul class="dropdown-menu">
<li class="dropdown-header">Member name (you)</li>
<li>
<img src="http://lorempixel.com/75/50/abstract/">0123 4567 8912 3456
</li>
<li>
<img src="http://lorempixel.com/75/50/abstract/">0123 4567 8912 3456
</li>
<li class="dropdown-header">Member name</li>
<li>
<img src="http://lorempixel.com/75/50/abstract/">0123 4567 8912 3456
</li>
</ul>
</div>
</div><!--dropdown for profile image,name and description -->
</div>
</div><!--container for header -->
<div class="container-fluid" style="border: 1px solid black">
<div class="row">
<div class="col-4 position-fixed align-self-start">
<nav id="sidebar">
<!-- Sidebar Header -->
<div class="sidebar-header">
<h3>Notification</h3>
</div>
<!-- Sidebar Links -->
<ul class="list-unstyled components">
<li class="active">Edit Profile</li>
<li>Privacy & Security</li>
<li>Payment Setting</li>
<li>Transaction History</li>
<li>Trust & Verfication</li>
<li>My Education Blog</li>
<li>Promotions</li>
</ul>
<ul>Cancel Account</ul>
</nav>
</div>
<div class="col-8 align-self-center">
<h3>Send notifications via</h3>
</div><!--this should be directly next to navbar -->
</div>
</div><!--container for navbar and page content -->
You can see that I have a header in the top page with an image and a dropdown in its own container. Then following that I have a container with the sidenav and where it says "get notifications via" is misplaced. I added borders so you can see the where everything is located.
I have to increase the width of search bar and make the border invisible while keeping it mobile responsive. Something like:
http://oneclass.com/#!/notes
HTML
<a class="navbar-brand page-scroll" href="#page-top">dss</a>
</div>
<!-- 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">
<li>
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control ipt" placeholder="Search" name="q">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</li>
<li>
Study Material
</li>
<li>
About us
</li>
<li>
Blog
</li>
</ul>
</div>
</div>
You can do it with CSS ...
Just add some style to the class element you want to edit...
I guess you can use something like this:
.ipt {
width: 100%;
position: absolute;
top: 0;
left: 0;
border: 0px;
border-bottom: 1px solid #ccc;
height: 50px;
font-size: 25px;
line-height: 45px;
}
DEMO
you can add some CSS to the input "text" tag.(which with a ipt class here).
.ipt {
border:none; //make the border invisible
width:75%; //set width to % instead of pixel to make it responsible.
height:50px;
font-size:22px; //control the text area's height of the text-input tag.
}
you may check a simple demo here. http://codepen.io/fukurouzhong/pen/JKdLVd
I have an administration screen with a sidebar. Everything works well except that the main content does not fill the browser width. I have tried many options but I am unable to solve this puzzle. Your help and advise is appreciated
Here is my HTML
<!-- top navigation menu element -->
<div id="wrap">
<div class="container-fluid">
<div class="row row-offcanvas row-offcanvas-left">
<div class="col-sm-3 col-md-2 sidebar-offcanvas" id="sidebar" role="navigation">
<ul class="nav nav-sidebar">
<li id="departments">
<i class="fa fa-fw fa-sitemap"></i> <span>Departments</span>
</li>
<li id="permissions">
<i class="fa fa-fw fa-key"></i> <span>Permissions</span> </a>
</li>
</ul>
</div><!-- .col-sm-3 .col-md-2 .sidebar-offcanvas -->
<div class="col-sm-9 col-md-10 main">
<!--toggle sidebar button-->
<p class="visible-xs">
<button type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">
<i class="glyphicon glyphicon-chevron-left"></i>
</button>
</p>
<h1 class="page-header inline-page-title">Groups</h1>
<!-- main content -->
</div><!-- .col-sm-9 .col-md-10 .main -->
</div> <!-- .row .row-offcanvas .row-offcanvas-left -->
</div><!-- .container-fluid -->
</div> <!-- #wrap -->
And my CSS
body {
padding-top: 50px;
background-color: #f5f5f5;
}
.main {
padding: 20px;
background-color: #fff;
border-left: 1px solid #dae3e9;
height: 100%;
box-shadow: -3px 3px 3px -2px #f1f1f3;
}
.sidebar-offcanvas {
min-height: 100%;
}
A clearer image showing the gap on the right side -
Found the problem - it was this piece of CSS that was causing the issue. I removed it and it works well - however leaving me with another problem. How do I constrain the width of my left side navbar without losing the responsive nature? Any suggestions are appreciated.
#media only screen
and (min-width : 1200px) {
.sidebar-offcanvas {
width: 180px;
}
}
I have the following HTML:
<nav class="navbar pr-navbar navbar-fixed-top" role="navigation">
<div class="navbar-header">
<div class="row">
<div class="navbar-left">
<a plat-tap='goBack()'><span class="fui-arrow-left pr-back"></span></a>
</div>
<div class="navbar-right">
<a plat-tap='goHome()'><span class="glyphicon glyphicon-home pr-home"></span></a>
</div>
<p class="pr-navbar-text">Manage/Add Users</p>
<div class="navbar-right">
<div class="pr-add-item">
<a plat-tap='addUser()'><span class="fui-plus"></span></a>
</div>
</div>
</div>
</div>
</nav>
Coupled with the following LESS:
#primaryColor: red;
#secondaryColor: blue;
#borderColor: white;
#textColor: white;
.pr-back{
color: #textColor;
}
.pr-home{
color: #textColor;
}
.pr-navbar-text{
color: #textColor;
text-align: center;
}
.pr-navbar {
background-color: #secondaryColor;
background-image: none;
background-repeat: no-repeat;
filter: none;
}
body { padding-top: 75px; }
#media screen and (max-width: 768px) {
body { padding-top: 53px; }
}
.pr-add-item {
padding-right: 75px
}
For some reason, the row element in my HTML does nothing. The plus icon is always put on a row beneath all the other buttons. How can I fix this so I have one row with a left aligned button, a center text, and two right aligned buttons?
Here, I started a fiddle for this.
JSFiddle here
<nav class="navbar pr-navbar navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="nav navbar-nav navbar-left">
<a plat-tap='goBack()'><span class="fui-arrow-left pr-back"></span></a>
</div>
<div class="nav navbar-nav navbar-right">
<a plat-tap='goHome()'><span class="glyphicon glyphicon-home pr-home"></span></a>
</div>
<p class="nav navbar-nav pr-navbar-text">Manage/Add Users</p>
<div class="nav navbar-nav navbar-right">
<div class="pr-add-item">
<a plat-tap='addUser()'><span class="glyphicon glyphicon-plus"></span></a>
</div>
</div>
</div>
</nav>
This HTML is closer to what you want. There were some unnecessary tags included in your original HTML, and also some important tags (like nav and navbar-nav) that were excluded. I suggest you read over this section of the bootstrap components page to understand how to get NavBars to work more cooperatively.
(I changed the glyph for your plus button and back arrow button so something would show up without including flat ui).
Edit: Altered the JSFiddle so that the text could be centered in the navbar.