I am trying to do menu similar to Chrome, inside drop down menu I want horizontal menu and vertical together.
my code:
<div id="mobileMenu" >
<ul class="nav">
<li><a href="" data-bypass>1</a></li>
<li><a href="" data-bypass>2</a></li>
<div class="oneLine">
<div class="row-fluid align-center">
<div class="span6">
<li><a href="" data-bypass>3</a></li></div>
<div class="span6">
<li><a href="" data-bypass>4</a></li><div></div>
</div>
</div>
</div>
<li><a href="" data-bypass>5</a></li>
<li><a href="" data-bypass>6</a></li>
<li><a href="" data-bypass>7</a></li>
</ul>
</div>
I thought maybe I can create additional class and divide this by different spans, to create one line with "3 and 4" horizontal, but it didn't work.
I tried without spans just with simple css:
.oneLine {
li {
display: inline;
a {
float: left;
clear:both;
width:50%;
border-right: 1px solid #969696;}
}
}
and it didn't work.
Maybe do you know how to do this?
Thanks a lot!
there are a lot possibilities of doing this.
Check this one http://jsfiddle.net/odd1y2nc/1/
<ul>
<li>Vertical</li>
<li>Vertical</li>
<li>Vertical</li>
<li>Vertical</li>
<li class="horizontal">Horizontal</li>
<li class="horizontal">Horizontal</li>
<li class="horizontal">Horizontal</li>
<li>Vertical</li>
<li>Vertical</li>
<li>Vertical</li>
</ul>
ul {
list-style: none;
}
ul li {
float: left;
width: 100%;
}
.horizontal {
width: 33%;
}
Related
I have problem with expandable and collapsible menu on mouse hover, I have code like this:
html:
<div ng-mouseout="showMenu=false" class="dashboard-menu">
<div ng-show="showMenu" class="sub-menu">
<ul>
<li><a class="lighting"><span>Add an action</span><span class="icon"></span></a></li>
<li><a class="html"><span>Add HTML/JS</span><span class="icon"></span></a></li>
<li><a class="image"><span>Add an image</span><span class="icon"></span></a></li>
</ul>
</div>
<div ng-mouseover="showMenu=true"><span class="icon plus"></span></div>
</div>
css:
.icon {
width: 60px;
height: 60px;
display: inline-block;
background: #000;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.plus {
float: right;
}
.dashboard-menu {
position: fixed;
bottom: 10px;
right: 10px;
}
why menu hide when I'm out of .plus icon? How to fix it? Here is a plunker.
I was also able to get your code working by adding the ng-mouseover="showMenu=true" to the dashboard-menu div.
<body ng-app>
<div class="dashboard-menu" ng-mouseover="showMenu=true" ng-mouseout="showMenu=false">
<div ng-show="showMenu" class="sub-menu">
<ul>
<li><a class="lighting"><span>Add an action</span><span class="icon"></span></a></li>
<li><a class="html"><span>Add HTML/JS</span><span class="icon"></span></a></li>
<li><a class="image"><span>Add an image</span><span class="icon"></span></a></li>
</ul>
</div>
<div ng-mouseover="showMenu=true"><span class="icon plus"></span></div>
</div>
</body>
Using ng-mouseleave fixed the issue.
First of all, I´m not very firm with CSS. I try to show an icon (right side) on my sidebar link (nav-first-level) on mouseover. The Sidebar-Link currently uses 100% of the Sidebar. Do you have a tip for me?
<ul>
<li class="nav-first-level">
<a class="facetGroup" href="#">Cardiology<span class="fa arrow"></span></a>
<span class="markGroup "><i class="fa fa-pencil fa-2" ></i></span>
<ul class="nav nav-second-level collapse">
<li ng-repeat="facet in cardiologyItems">
<span>{{ facet.name }}</span>
</li>
</ul>
</li>
</ul>
this should get you there, take a look (show image icon on rollover with CSS).
• Swap .image class with your .facetGroup > remove <span> use a <div> and swap demo .play class with your .markGroup. Basically follow how it's done below and customize with your selectors!
<div class="itemsContainer">
<div class="image"> <img src="http://www.itsalif.info/blogfiles/video-play/vthumb.jpg" /> </div>
<div class="play"><img src="http://cdn1.iconfinder.com/data/icons/flavour/button_play_blue.png" /> </div>
</div>
CSS:
.itemsContainer {
background:red;
float:left;
position:relative
}
.itemsContainer:hover .play{display:block}
.play{
position : absolute;
display:none;
top:20%;
width:40px;
margin:0 auto; left:0px;
right:0px;
z-index:100
}
Use li:hover property.Try this:
<html>
<body>
<style>
ul li ul li:hover {
list-style-image: url('https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-arrow-forward-16.png');
}
ul li ul li
{
list-style-type: none;
}
</style>
<ul>
<li>Cardiology
<ul>
<li>citem1</li>
<li>citem2</li>
<li>citem3</li>
</ul>
</li>
<li>Other
<ul>
<li>oitem1</li>
<li>oitem2</li>
<li>oitem3</li>
</ul>
</li>
</ul>
</body>
</html>
Working JSFiddle sample: https://jsfiddle.net/t41w9u2w/2/
The screenshot below is my bootstrap navbar which works nicely (pills disappear one by one as per spec). However when scaled down to various screen sizes, the navbar is no longer in-line and becomes staggered.
The issue is worse in Chrome than in Firefox because the left hand section of the navbar does not sit at the top of the screen.
If I can get Chrome to look like the Firefox screenshot, this will help me fix the remaining issues.
Can anyone suggest which browser rendering inconsistency would explain why on the Chrome version, the left hand portion of the navbar does not sit flush with the top of the screen?
Top is Chrome, bottom is FireFox.
<header>
<div class="vr-nav-container" data-ng-controller="navBarController">
<div>
<div class="col vr-nav-col1">
<div class="nowrap">
<nav class='navbar navbar-default navbar-static-top no-padding" role="navigation"'>
<a class='navbar-brand' href='/Default'>
<img height="30" class="logo" alt="Flatty" src="/Assets/images/logo-small-rocket-lg.png" />
<img height="30" id="xs-toggler" class="logo-xs" alt="Flatty" src="/Assets/images/logo_xs.png" />
</a>
</nav>
</div>
</div>
<div class="col vr-nav-col2 fill center">
<div class="nowrap">
<nav class='navbar navbar-default navbar-static-top " role="navigation"'>
<div class="tabbable ">
<ul class="nav nav-pills contrast-background">
<li data-ng-repeat="item in NavBarViewModel">
<a href="{{item.Path}}"><i class="{{item.Icon}}"></i>
{{item.Title}}
</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
<div class="col vr-nav-col3">
<div class="nowrap">
<nav class='navbar navbar-default navbar-static-top" role="navigation"'>
<ul class='nav'>
<li ng-controller="awardBoxController" class='dropdown medium only-icon widget'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>
<i class='icon-trophy'></i>
<div class='label'>{{AwardSummary.TotalPoints}}</div>
</a>
<ul class='dropdown-menu'>
<li>
<div class="box-content box-statistic">
<h3 class="title text-error">{{AwardSummary.Level}}</h3>
<small>{{AwardSummary.TotalPoints}} points</small>
<div class="text-banana icon-trophy align-right"></div>
</div>
</li>
<li><a href="/#/Awards/My-Points/">
<div class='points-history box-content widget-body'>
<div class='pull-left icon'>
<i class='icon- text-banana'></i>
</div>
<div class='pull-left text'>
<span><strong>Point History</strong> <span class="see-all">- see all</span></span>
<small class='text-muted'>{{award.AcheivedDate}}</small>
</div>
</div>
</a></li>
<li ng-repeat="award in AwardSummary.Awards">
<a href='#'>
<div class=' box-content widget-body'>
<div class='pull-left icon'>
<i class='icon-{{award.Icon}} text-success'></i>
</div>
<div class='pull-left text'>
{{award.Name}}
<span class="text-muted">+{{award.Points}}</span>
<small class='text-muted'>{{award.AcheviedDate| fromNow}}</small>
</div>
</div>
</a>
</li>
<li class='divider'></li>
<li class='widget-footer'>
<a href='/#/Awards/High-Scores/'>High Scores</a>
</li>
</ul>
</li>
<li class='dropdown medium user-menu'>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>
<img width="23" height="23" src="/Assets/images/avatar.jpg" />
<span class='user-name'>
<asp:Literal ID="UserFirstNameLiteral" runat="server" meta:resourcekey="UserFirstNameLiteral">FirstName LastName</asp:Literal></span>
<b class='caret'></b>
</a>
<ul class='dropdown-menu'>
<li>
<a href='/UserAccount/UserProfile'>
<i class='icon-user'></i>
<%= this.GetGlobalResourceObject("MasterPage","Profile") %>
</a>
</li>
<li>
<a ng-if="ShowSettings" href='/Settings/Dashboard'>
<i class='icon-cog'></i>
<%= this.GetGlobalResourceObject("Resources","Settings") %>
</a>
</li>
<li>
<a ng-if="ShowSettings" href='http://todo.help.vr.zendeskurl.com'>
<i class='icon-bullhorn'></i>
<%= this.GetGlobalResourceObject("MasterPage","GetHelp") %>
</a>
</li>
<li class='divider'></li>
<li>
<form runat="server">
<asp:LinkButton ID="SignOutLinkButton" runat="server" OnClick="SignOutLinkButton_Click" meta:resourcekey="SignOutLinkButton">
<i class='icon-signout'></i> <%= this.GetGlobalResourceObject("Resources","SignOut") %>
</asp:LinkButton>
</form>
</li>
</ul>
</li>
</ul>
<div class='navbar-form navbar-right hidden-xs'>
<button class='btn btn-link dropdown-toggle' style="top: 4px;" name='button' data-toggle="dropdown" type='submit'><i class="icon-search"></i><span class="caret"></span></button>
<ul class="dropdown-menu">
<li>
<a category="" class="searchoption" href="#"><%= this.GetGlobalResourceObject("MasterPage","Everything") %></a>
</li>
<li class="divider"></li>
<li>
<a category="Deals" class="searchoption" href="#"><%= this.GetGlobalResourceObject("Resources","Deals") %></a>
</li>
<li>
<a category="Contacts" class="searchoption" href="#"><%= this.GetGlobalResourceObject("Resources","Contacts") %></a>
</li>
<li>
<a category="Accounts" class="searchoption" href="#"><%= this.GetGlobalResourceObject("Resources","Accounts") %></a>
</li>
<li>
<a category="Tasks" class="searchoption" href="#"><%= this.GetGlobalResourceObject("Resources","Tasks") %></a>
</li>
</ul>
<div class='form-group'>
<input value="" id="searchBox" class="form-control" placeholder='<%= this.GetGlobalResourceObject("Resources","Search") %>...' autocomplete="off" id="q_header" name="q" type="text" />
</div>
</div>
</nav>
</div>
</div>
</div>
</div>
</header>
CSS
I am using the default bootstrap 3.0 CSS and have a seperate CSS file overriding some default CSS and adding my own
I had to do this because the pills section has to be in its own div in the centre column in order to work (disappear one by one and 'stack' as width decreases) and fill all the width between the left and right cols in the navbar.
.navbar-collapse:after {
clear: none;
}
.sorting, .sorting_asc, .sorting_desc {
background : none;
}
.top-buffer {
margin-top: 20px !important;
}
.removeclass{
font-size: 1.5em;
vertical-align: middle !important;
}
.removeclass:hover{
text-decoration: none;
}
.vr-navigation {
float: left;
width: 100%;
}
.rightnav {
float: right;
width: 285px;
margin-left: -160px;
}
.leftnav {
margin-right: 160px;
padding:0 10px;
width:auto;
height: 40px;
}
.nav-pills {
height: 40px;
}
.hidden-xs {
display: inline-block !important;
}
#media (max-width: 767px) {
.hidden-xs {
display: none!important;
}
}
.current {
font-weight: bold;
}
.nav-pills li a {
color: white;
}
.vr-nav-container
{
display: table;
}
.vr-nav-container > div
{
display: table-row;
}
.vr-nav-container > div > div
{
display: table-cell;
}
.vr-nav-container > div > div
{
padding: 0em;
}
.vr-nav-container .nowrap
{
white-space: nowrap;
}
.vr-nav-container .fill
{
margin: 0 auto;
}
.vr-nav-container .center
{
text-align: center;
}
.vr-nav-col1
{
/*background: red;*/
width: 5%;
min-width: 50px;
white-space: nowrap;
}
.vr-nav-col2
{
width: 50%;
margin: 0 auto;
/*background: yellow;*/
}
.vr-nav-col3
{
/*background: green;*/
width: 40%;
/*min-width: 260px;*/
}
.no-padding
{
padding-left: 0px !important;
padding-right: 0px !important;
}
.main-nav-closed #main-nav .navigation > .nav > li:hover > a.toggler-flyout > span
{
display: none;
}
/*.main-nav-closed #main-nav .navigation > .nav > li:hover > a.toggler-flyout > i
{
content: "\f061";
}*/
For each list item, I want an image with text below the image.
I read on this technique, but it is not supported in IE. Instead, I'm floating the list items to the left. It does the trick except the content below the list wraps to the right. How do I prevent the content from wrapping this way?
Here is my code:
<style>
.horizlist{
list-style:none;
text-align:center;
}
#menulist ul{
width:360px;
}
#menulist li{
float:left;
padding-right:50px;
}
#menulist li img{
display:block;
}
</style>
<div id="container" style="">
<div id="top">
<img src="joblove.jpg" style="float:right;">
<div id="title" style="width:500px;text-align:center;">
<h1>"THE TOUGHEST JOB YOU'LL EVER LOVE:"</h1>
<p style="font-size: 1.6em;">A RESOURCE FOR THOSE THINKING ABOUT A CAREER IN DIRECT CARE</p>
</div>
</div>
<div id="menulist">
<ul class="horizlist" >
<li>
<img src="images/purplestyle_11_home.png"></img><span>Home</span>
</li>
<li>
<img src="images/purplestyle_01_heart.png"><span>Brochure</span>
</li>
<li>
<img src="images/purplestyle_05_cut.png"><span>Video</span>
</li>
<li>
<img src="images/purplestyle_15_buddies.png"><span>Personality</span>
</li>
<li>
<img src="images/purplestyle_03_folder.png"><span>Resources</span>
</li>
<li>
<img src="images/purplestyle_02_talk.png"><span>FAQ</span>
</li>
</ul>
</div>
<img src="phone.jpg">
<ul class="horizlist">
<li><button type="button">Click </li>
<li></li>
</ul>
</div>
Add an height to #menulist in css :
#menulist ul{
width:360px;
height:100px;
}
Use CSS backgrounds. They give you more control over image positioning and require less mark-up.
HTML:
<a class="home" href="home">Home</a>
CSS:
.horizlist a {
display:block;
background-repeat:no-repeat;
padding-top: 20px;
padding-left: 20px
background-position: 10px 10px;
a.home {
background-image:url(/images/purplestyle_11_home.png);
}
Can can adjust the padding and background-position values to suit. Repeat as needed.
I am fairly new to web development and I have been trying to create a site, so far I have managed to do a navigation menu and a logo. My issue is that after thoroughly trying many tutorials and posts I have been unable to resolve my issue.
I want to align my logo with my navbar so that the logo is on the left hand side and the navbar is in line with the logo but on the right hand side, with both of them next to each other.
next questions is how to create a drop down menu for some of navbar tabs?
thankyou
My html is as follows
<!DOCTYPE html>
<html>
<head>
<title>S3ntry Aust Transport</title>
<link href="navbarlog.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container" id="Layout1" style="overflow: auto; ">
<header>
<div id="menu">
<img src="logo.JPG" style="float: left; " alt="logo" name="logo" width="571"
height="176" id="logo"></a>
</div>
</header>
<ul>
<li><a id="nav-index" class="first" href="%E2%80%9D#%E2%80%9D">Home</a></li>
<li><a id="nav-aboutus" href="%E2%80%9D#%E2%80%9D">About Us</a></li>
<li><a id="nav-ourservices" href="%E2%80%9D#%E2%80%9D">Our Services</a></li>
<li><a id="nav-environment" href="%E2%80%9D#%E2%80%9D">Environment</a></li>
<li><a id="nav-latestnews" href="#">Latest News</a></li>
<li><a id="nav-contactus" class="last" href="%E2%80%9D#%E2%80%9D">Contact Us</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
and the css part is as follows
ul {list-style-type:none; margin:0 auto; width:640px; padding:0; overflow:hidden;}li
{float:left;}
ul li a {display:block; text-decoration:none; text-align:center; padding:22px 20px 22px
20px;font-family:Arial; font-size:8pt; font-weight:bold; color:#000000; text-
transform:uppercase; border-right:1px solid #607987; background-color:#FFFFFF; text-
transform:uppercase; letter-spacing:.08em}
ul li a:hover {background-color:#3b6a85; color:#a2becf}
ul li a.first {border-left:0}
ul li a.last {border-right:0}}
#header ul li {
list-style: none;
display:inline-block;
float:right
}
logo.JPG
{
vertical-align:middle;
float:left
}
If you were to restructure your HTML, moving your 'ul' into the header, it's very easy.
<header>
<div id="logo">
<img src="logo.JPG" style="float: left; " alt="logo" name="logo" width="571" height="176" id="logo">
</div>
<div id="menu">
<ul>
<li><a id="nav-index" class="first" href="%E2%80%9D#%E2%80%9D">Home</a></li>
<li><a id="nav-aboutus" href="%E2%80%9D#%E2%80%9D">About Us</a></li>
<li><a id="nav-ourservices" href="%E2%80%9D#%E2%80%9D">Our Services</a></li>
<li><a id="nav-environment" href="%E2%80%9D#%E2%80%9D">Environment</a></li>
<li><a id="nav-latestnews" href="#">Latest News</a></li>
<li><a id="nav-contactus" class="last" href="%E2%80%9D#%E2%80%9D">Contact Us</a></li>
</ul>
</div>
</header>
and the CSS needed
header { width: 700px; }
#logo { float: left; }
#menu { float: right; }
#menu ul { padding: 0; margin: 0; }
Here is a JSFiddle showing it working: http://jsfiddle.net/STu89/
I've also removed a which wasn't opened and stripped out various /div which weren't matched.