I know this seems silly, but this menu is driving me nutty. I've fixed it a few times, but it keeps coming back and biting me in the butt.
The menu looks like this. And as you can see half of it is cut off so you cannot read the words.
I have tried many ways to fix this. I have moved the menu around in the html, tried positioning it and adding a z-index. But I have had no luck.
The html looks like this
<div class="pull-right" style="padding-top: 0px;">
<!-- drop button -->
<div class="btn-group js_editTab-wrapper open" data-bind="attr: { 'data-id' : id, 'data-type' : entityType}" data-id="25402" data-type="KioskPageControl">
<!-- ko if : $data.editTabs -->
<button type="button" class="btn btn-primary btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu dropBorder" role="menu" data-bind="foreach: $data.editTabs">
<li>Appearance</li>
<li>Identification</li>
<li>Parameters</li>
<li>Rules</li>
</ul>
<!-- /ko -->
</div>
<span class="drag btn-xs btn-labeled btn-info">
<span class="btn-label"><span class="glyphicon glyphicon-move"></span></span>
</span>
<span class="remove btn-xs btn-labeled btn-danger">
<span class="btn-label"><span class="glyphicon glyphicon-remove"></span></span>
</span>
</div>
and the css for the menu looks like this
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
list-style: none;
overflow: visible;
Obviously the display none turns to block when clicked on the dropdown menu and the blue bar does have a z-index on it of 1. Any help would be appreciated!
Related
I have implemented an UI. There I have 4 tabs.
The gap between the tabs are different(inconsistent) and If I try to make width to auto, then the indicator below the tab is not displayed.
code for the tabs -
<div class="MuiTabs-flexContainer" role="tablist">
<button class="MuiButtonBase-root MuiTab-root jss2 MuiTab-textColorInherit Mui-selected" tabindex="0" type="button" role="tab" aria-selected="true">
<span class="MuiTab-wrapper">Aikika</span>
<span class="MuiTouchRipple-root"></span>
</button>
<button class="MuiButtonBase-root MuiTab-root jss2 MuiTab-textColorInherit" tabindex="-1" type="button" role="tab" aria-selected="false">
<span class="MuiTab-wrapper">Qwertyuio</span>
<span class="MuiTouchRipple-root"></span>
</button>
<button class="MuiButtonBase-root MuiTab-root jss2 MuiTab-textColorInherit" tabindex="-1" type="button" role="tab" aria-selected="false">
<span class="MuiTab-wrapper">Plmojnuhbtf</span>
<span class="MuiTouchRipple-root"></span>
</button>
<button class="MuiButtonBase-root MuiTab-root jss2 MuiTab-textColorInherit" tabindex="-1" type="button" role="tab" aria-selected="false">
<span class="MuiTab-wrapper">Tokjl Test</span>
<span class="MuiTouchRipple-root"></span>
</button>
</div>
and code for indicator ( underline below to the tab )-
<span class="jss3 jss5 MuiTabs-indicator jss1" style="left: 0px; width: 120px;"></span>
CSS code is -
.MuiTabs-flexContainer button {
min-width: 120px;
font-weight: 100;
margin-top: 8px;
}
CSS code for indicator -
.jss1 {
height: 3px;
background-color: #09728e;
}
Currently everything working fine but gap between the tabs are inconsistent. I want my tab to be consistent and indicator should also work fine. I have attached the screenshot for the reference. Red box showing the gap between tab & blue line showing the indicator below the tabs.
You can try to do something like this:
.MuiTabs-flexContainer{
display: flex;
align-items: center;
justify-content: space-between;
}
In bootstrap 3, I have a button group. If the first item in the button group has a hidden class, the first visible element loses it's rounded border radius.
How can I modify the CSS below so that if the first element has a hidden class, the first visible element should still have the rounded corners on the left?
body{padding:20px}
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>
<div role="group" class="btn-group btn-group-sm" id="preview-paging">
<div role="group" class="btn-group hidden" id="preview-type">
<button data-toggle="dropdown" class="btn btn-default btn-sm dropdown-toggle" type="button">
<span id="preview-label">Desktop</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a data-device="desktop" href="#design">Desktop</a></li>
<li><a data-device="mobile" href="#design">Mobile</a></li>
</ul>
</div>
<div class="btn btn-default btn-sm btn-paging" id="preview-prev"><i class="fa fa-chevron-left"></i></div>
<div class="btn btn-default btn-sm btn-paging" id="preview-next"><i class="fa fa-chevron-right"></i></div>
</div>
The best solution would be Javascript.
If you know your HTML won't change (you will just have those 3 divs) you can use:
.btn-group div:first-child + div:not(.hidden) {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
You should then change the rule below or add an !important to the rule above.
.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle)
I am using "bootstrap": "~3.3.4" inside the mean.js framework. The navbar dropdown menu does not have any problem opening and staying put when the dropdown icon is clicked on desktop. But after getting pushed to the staging server, clicking the icon on the iphone and samsung galaxy browsers no longer opens the dropdown menu or it sometimes opens it but it does not stay opened.
Here is the code:
<div class="landing-page-header">
<div class="navbar-header" >
<button class="navbar-toggle mytoggle" type="button" data-ng-click="toggleCollapsibleMenu()">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a data-ui-sref="home" class="navbar-brand">
<img class="header-logo" ng-src="modules/core/img/home/myimg.png" height="">
</a>
</div>
<nav class="collapse navbar-collapse" data-ng-show="!authentication.user" collapse="!isCollapsed" role="navigation">
<ul class="nav navbar-nav navbar-right landing-page-nav" data-ng-hide="authentication.user">
<li class="text-center" data-ng-repeat="item in menu.items | orderBy: 'position'"
data-ng-if="item.roles.indexOf('guest') !== -1"
ng-switch="item.type"
data-ng-class="{active: $state.includes(item.state)}"
class="{{item.class}}"
target="{{item.target}}"
dropdown="item.type === 'dropdown'">
<a ng-switch-when="dropdown" class="dropdown-toggle">
<span data-ng-bind="item.title"></span>
<b class="caret"></b>
</a>
<ul ng-switch-when="dropdown" class="dropdown-menu">
<li data-ng-repeat="subitem in item.items | orderBy: 'position'" data-ng-if="subitem.shouldRender(authentication.user);" data-ui-sref-active="active">
<a data-ui-sref="{{subitem.state}}" data-ng-bind="subitem.title"></a>
</li>
</ul>
<a ng-switch-default data-ui-sref="{{item.state}}" data-ng-bind="item.title"></a>
</li>
<li class="divider-vertical"></li>
<li class="text-center " data-ui-sref-active="active">
<a data-ui-sref="authentication.signin" target="_self">SIGN IN</a>
</li>
</ul>
</nav>
</div>
And Here is the CSS:
.landing-page-header {
position: fixed;
left: 0px;
top: 0px;
opacity: 0.9;
background: #111;
width:100%;
height: 5em;
z-index: 99;
margin-bottom: 10em;
}
.navbar-brand img {
/*background: #fff;*/
}
.landing-page-header ul {
background: #111;
margin-right:0.5em;
}
I had looked at other answers on this site and googled the issue. One answer I came across suggested to use a or input instead of button, but I still faced the same issue.
What is happening in the browser is that, on button click (hamburger) (on galaxy and iphone) immediately after the code is pushed to the staging server the navbar renders, but once a menu item is clicked, when you go back and click on the hamburger menu again, the navbar will behave weird starting to render and stopping and going back immediately.
Anyone has any idea?
I have found a solution for it myself. I just had to set the position of the drop down to "static" for screens less than 480px.
#media (max-width: 480px) {
.landing-page-header ul{
position: static;
width:100%;
}
}
I am now using Twitter Bootstrap 3 RC2 as well as Twitter Bootstrap which has moved into a separate repository. I have noticed, if used in a button with text the icon is not centered very well:
The icon and the text have the same bottom line, but I believe for a good looking button the icon should be centered based on the text, shouldn't it? Any idea how to achieve this?
http://bootply.com/74652
Move the text out of the <span> with the glyphicon and apply vertical-align: middle; to the <span>
<button class="btn btn-default">
<span class="glyphicon glyphicon-th" style="vertical-align: middle;"></span> Centered
</button>
Demo
This works in Bootstrap 4 with Font Awesome icons like so
<button class="btn btn-default" style="vertical-align: middle;">
<i class="fa fa-times"></i> Centered
</button>
Apply a vertical-align: -{N}px; style on the .glyphicon-th to shift it N pixels up/down.
For some vertical-align might not work due to positioning: If you look into .glyphicon class you'll see it is set to relative, try setting it to 'inherit' e.g:
.glyphicon.v-centered {
position: inherit;
vertical-align: middle;
}
This should also work for icons not in buttons, e.g. tabs.
Try vertical-align: middle; on .glyphicon-th:before
None of the methods above worked well for me by themselves, but using display: inline-block; vertical-align: middle on the elements did. It's the inline-block that seems to be key.
.vcenter * {
vertical-align: middle;
display: inline-block;
}
.btn i {
margin-left: 10px;
font-size: 20px;
}
with
<div class="vcenter">
<button class="btn btn-default btn-lg"><span>Centered</span><i class="glyphicon glyphicon-ok"></i></button>
<button class="btn btn-default"><span>Centered</span><i class="glyphicon glyphicon-ok"></i></button>
<button class="btn btn-default btn-sm"><span>Centered</span><i class="glyphicon glyphicon-ok"></i></button>
</div>
See http://www.bootply.com/UbY78zM8pD for live example.
I managed to do it like this:
.glyphicon.center:before {
vertical-align: middle;
}
and use <span class="glyphicon center glyphicon-th"></span>.
Problem: Glyph icon was 2 px too high above the button text. Fixed it as follows using examples here. Thank you (Alastair Maw).
I managed to get mine working as follows:
HTML
<div class="col-xs-12">
<a title="" class="btn btn-block btn-info oa-btn-spacer_homepage oa-ellipsis" role="button" href="default.aspx?action=page&name=creditcard">
<span class="glyphicon glyphicon-credit-card glyph_Credit"></span> Update Your Credit Card and Billing Information
</a>
</div>
CSS
#panelTopic .glyph_Credit {
vertical-align: middle;
display: inline-block;
padding-bottom:6px;
}
<button class="btn btn-default">
<span class="glyphicon glyphicon-th" style="font-size: 14px;"> </span>
<span style="font-size: 17px;">Not Centered</span>
</button>
please increase or decrease the font size according to your requirement
Other way
<button class="btn default" id="IdBack">
<i class="glyphicon glyphicon-hand-left"></i>
<b>Back</b>
</button>
Add a margin of the specific pixels or percentage. In my app, this worked beautifully, based on the dimensions of the area.
CSS:
.someWrapperClass button span {
margin-top: 120%;
}
HTML:
<div class="someWrapperClass">
<button type="button" ng-click="SomeMethod()">
<span class="glyphicon glyphicon-chevron-left"></span>
</button>
</div>
The Bootstrap .dropdown-menu.pull-right selector doesn't seem to work (the code is in navbar.less, lines 330 to 341).
As you can see on this screenshot, the up caret is not aligned to the right.
My dropdown-menu class :
<ul class="dropdown-menu pull-right">
When I change line 286 to
right:10px;
it works fine.
Any idea on how to fix this ?
Here is my html code:
<div id="USE_dropdown_signin" class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-user"></i> Sign in
</a>
<ul class="dropdown-menu pull-right">
<form action="" method="post" accept-charset="UTF-8">{% csrf_token %}
<input id="USE_signin_username" type="text" name="signin[username]" size="30" placeholder="User Name"/>
<input id="USE_signin_password" type="password" name="signin[password]" size="30" placeholder="Password"/>
<input id="USE_signin_remember_me" type="checkbox" name="signin[remember_me]" value="1" />
<label id="USE_signin_remember_me_label" class="string optional" for="signin_remember_me"> Remember me</label>
<input id="USE_signin_submit" class="btn btn-primary" type="submit" name="commit" value="Sign in" />
</form>
</ul>
</div>
From your screenshot, I would assume that you have used .btn-group class to make your white log in button.
Assign "pull-right" class to the div element containing btn-group class instead of the ul element.
Correct Html markup
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<i class="icon-user"></i> Username
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>Profile</li>
<li class="divider"></li>
<li>Sign Out</li>
</ul>
</div>
Based on what I have analyzed on the twitter bootstrap, you will require the following css to work.
.navbar .pull-right .dropdown-menu, .navbar .dropdown-menu.pull-right {
right: 0;
left: auto;
}
.pull-right > .dropdown-menu {
right: 0;
left: auto;
}
.pull-right { float: right; }
Here is what I didn't understand:
1) The boostrtap selector in navbar.less line 329-330
.navbar .nav.pull-right .dropdown-menu,
.navbar .nav .dropdown-menu.pull-right {}
didn't match my dropdown-menu because I don't have the parent .nav class in my hierarchy.
2) My .dropdown-menu has the class .pull-right, and this doesn't match:
.navbar .dropdown-menu:before .pull-right {
left: auto;
right: 9px;
}
but this does:
.navbar .pull-right .dropdown-menu:before {
left: auto;
right: 9px;
}
3) I couldn't debug correctly until I removed the -yui-compress option of the less compiler ;-)
Thanks for everything!