Submenu, set position more left - html

i've a small problem with my slide menu. The slide is fadin in from down to up. This also is working fine.
But now I want to set the position a bit more to the left side, so that i get a line with the main menu.
Maybe someone can help me. This is my sample...
This is my code... [Menu][1] https://jsfiddle.net/Tabes/eb52suo1/15/

Here is your solution
.flex-box {
width: 100%;
min-height: 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;
align-content: flex-start;
}
.navigation {
background-image: linear-gradient(#444, #111);
background-color: #111;
width: 100%;
}
/* ******************************************************************************************* */
/* ***** Main Navigation - Main Level ******************************************************* */
/* ******************************************************************************************* */
.nav_main {
background: transparent;
list-style: none;
}
.nav_main ul:before,
.nav_main ul:after {
content: "";
display: table;
}
.nav_main ul {
list-style: none outside none;
position: relative;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
align-content: center;
margin: 0px;
padding: 0px;
min-width: auto;
min-height: auto;
zoom: 1;
}
.nav_main ul li:before,
.nav_main ul li:after {
content: "";
display: inline;
}
.nav_main ul li.icon:before,
.nav_main ul li.icon:after {
display: inline-block;
margin: 2px 15px 0px 0px;
width: 15px;
height: 15px;
}
.nav_main ul li.icon:before {
background: url("../pic/icons/glyphicons-387-log-in.png") no-repeat top right;
background-size: 15px;
float: left;
margin: 2px 15px 0px 0px;
}
.nav_main ul li.icon:after {
background: url("../pic/icons/glyphicons-415-disk-save.png") no-repeat top left;
background-size: 15px;
float: right;
margin: 2px 0px 0px 15px;
}
.nav_main ul li>img.before,
.nav_main ul li>img.after {
display: inline-block;
margin: 2px 15px 0px 0px;
width: 15px;
height: auto;
}
.nav_main ul li>img.before {
float: left;
margin: 2px 15px 0px 0px;
}
.nav_main ul li>img.after {
float: right;
margin: 2px 0px 0px 15px;
}
.nav_main ul li:last-child {
border-right: none;
box-shadow: none;
}
.nav_main ul li:hover {
background: #444;
display: inline-block;
margin: 0px;
padding: 10px 35px;
min-width: auto;
min-height: auto;
}
.nav_main ul li {
border-right: 1px solid #222;
box-shadow: 1px 0 0 #444;
cursor: pointer;
text-align: center;
display: inline-block;
flex: 0 0 auto;
position: relative;
margin: 0px;
padding: 10px 35px;
min-width: auto;
min-height: auto;
}
.nav_main ul li>a:hover {
color: #fafafa;
}
.nav_main ul li>a {
font: bold 12px Arial, Helvetica;
text-transform: uppercase;
text-decoration: none;
text-shadow: 0 1px 0 #000;
color: #999;
}
.nav_main ul li:hover>ul {
visibility: visible;
opacity: 1;
margin: 0;
}
/* ******************************************************************************************* */
/* ***** Main Navigation - Level #1 ******************************************************** */
/* ******************************************************************************************* */
.nav_main ul ul {
list-style: none outside none;
position: absolute;
background: #444;
box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.3);
border-radius: 3px;
flex-direction: column;
align-items: flex-start;
visibility: hidden;
opacity: 0;
top: 40px;
left: 0;
z-index: 5;
transition: all 0.2s ease-in-out;
margin: 10px 0px 0px 0px;
padding: 0px;
min-width: 185px;
min-height: 35px;
width: auto;
}
.nav_main ul ul li:before,
.nav_main ul ul li:after {
content: "";
display: inline;
}
.nav_main ul ul li.icon:before,
.nav_main ul ul li.icon:after {
display: inline-block;
margin: 4px 35px 0px 0px;
width: 15px;
height: 15px;
}
.nav_main ul ul li.icon:before {
background: url("../pic/icons/glyphicons-387-log-in.png") no-repeat top right;
background-size: 15px;
float: left;
margin: 4px 35px 0px 0px;
}
.nav_main ul ul li.icon:after {
background: url("../pic/icons/glyphicons-415-disk-save.png") no-repeat top left;
background-size: 15px;
float: right;
margin: 4px 0px 0px 35px;
}
.nav_main ul ul li>img.before,
.nav_main ul ul li>img.after {
display: inline-block;
margin: 4px 35px 0px 0px;
width: 15px;
height: auto;
}
.nav_main ul ul li>img.before {
float: left;
margin: 4px 35px 0px 0px;
}
.nav_main ul ul li>img.after {
float: right;
margin: 4px 0px 0px 35px;
}
.nav_main ul ul li:hover {
background: #444;
background-image: linear-gradient(#04acec, #0186ba);
background-color: #0186ba;
display: inline-block;
margin: 0px;
padding: 5px 15px;
min-width: 185px;
min-height: 35px;
}
.nav_main ul ul li:first-child:hover {
border-radius: 3px 3px 0px 0px;
}
.nav_main ul ul li:last-child:hover {
border-radius: 0px 0px 3px 3px;
}
.nav_main ul ul li {
border: none;
box-shadow: none;
text-align: left;
display: inline-block;
flex: 0 0 auto;
margin: 0px;
padding: 5px 15px;
min-width: 185px;
min-height: 35px;
}
.nav_main ul ul li>a:hover {
color: #fafafa;
}
.nav_main ul ul li>a {
font: bold 12px Arial, Helvetica;
text-transform: uppercase;
text-decoration: none;
text-shadow: 0 1px 0 #000;
color: #999;
}
.nav_main ul ul li:hover>ul {
visibility: visible;
opacity: 1;
margin: 0;
}
<!-- Main Navigation (Container for JavaScript Function)-->
<div id="Navigation" class="navigation">
<!-- ### Main Navigation Link Liste ### -->
<nav id="Nav_Main" class="nav_main">
<ul class="flex-box">
<li>
Home
<ul class="flex-box">
<li>
Referenzen
</li>
<li>
Downloads
</li>
<li>
Partner Programm
</li>
<li>
Existenzgründer
</li>
<li>
<!-- Philosophie -->
Philosophie
</li>
</ul>
</li>
<li>
Hosting
<ul class="flex-box">
<li>
Web Hosting
</li>
<li>
TYPO3
</li>
<li>
WordPress
</li>
<li>
Magento
</li>
<li>
PrestaShop
</li>
</ul>
</li>
<li>
<a class="ajaxy" href="webdesign.html">WebDesign</a>
</li>
</ul>
</nav>
<!-- ### Main Navigation Link Liste End ### -->
</div>
<!-- Main Navigation Container End -->

Inside your flex-box class you can add a margin-left: -35px; and it will fix the position of the sub menu according to the snippet. You should mention though, that this might cause problems for the responsive part of your site.

Related

Style for pills in navbar

How can i make custom pills for navbar like on
screenshot?
I did it by myself, but pills are inside of navbar and the text is not in the center of pill.
I understand, that the problem is inside of .menu li a:hover:not and .menu li a:hover:not(.active). But i don't know, how to make outside of navbar(i mean borders of the pills like on screenshot)
.menu {
padding-top: 10px;
padding-bottom: 10px;
font-size: 20px;
margin-left: auto;
margin-right: auto;
}
.menu ul {
margin: 0 auto;
padding: 0px;
overflow: hidden;
display: block;
list-style:none;
border-radius: 20px 0 0 0;
background-color: #0b78ad;
text-align: center;
}
.menu li {
list-style-type: none;
text-align: center;
display: inline-block;
}
.menu ul li a {
padding: 10px;
padding-left: 50px;
margin: 0px;
display: block;
text-align: center;
}
.menu li a:hover:not(.active) {
color: #325491;
}
.menu li.active a {
border-radius: 20px 0 20px 0;
border-style: solid;
border-width: 2px;
border-color: #325491;
color: #325491;
background-color: white;
}
<div class="menu">
<ul>
<li class="active">startseite</li>
<li>über uns</li>
<li>zell-linien</li>
<li>downloads</li>
<li>kontakt</li>
</ul>
</div>
.menu {
font-family: Arial, sans-serif;
}
.menu ul {
padding: 0;
list-style: none;
background-color: #0b78ad;
text-align: center;
white-space: nowrap;
height: 34px;
margin: 30px 0;
}
.menu li {
position: relative;
top: -10px;
list-style-type: none;
text-align: center;
display: inline-block;
margin: 0 10px;
}
.menu ul li a {
position: relative;
display: block;
padding: 18px;
border-top-left-radius: 10px;
border-bottom-right-radius: 10px;
border: 2px solid transparent;
text-align: center;
text-decoration: none;
text-transform: uppercase;
color: #FFF;
font-weight: 700;
line-height: 1;
transition: all .1s ease-in-out;
}
.menu ul li a.active,
.menu ul li a:hover {
background-color: #FFF;
border: 2px solid #0b78ad;
color: #0b78ad;
}
<div class="menu">
<ul>
<li>Home</li>
<li>About</li>
<li>Skill</li>
<li>Contact</li>
</ul>
</div>
You can do it with just a plain border-radius, like any other property it starts with top, right, bottom and right
.button {
display: inline-block;
background-color: #ededed;
border: 1px solid deepskyblue;
border-radius: 10px 0 10px 0;
padding: 10px 16px;
text-align: center;
}
<div class="button">shape</div>
You can do like this.
1. Navbar you can give a 'max-height' property so that we can set a height for the first-child.
#nav-id {
max-height: 65px;
margin-top: 20px;
}
2.We can set the first 'li' 'margin-top' or 'position'
li:first-child {
border-radius: 15px 50px;
padding: 20px;
width: 200px;
height: 106px;
background: blue;
background-position: center;
margin-top:-20px;
z-index:1;
text-align:center;
}
Here is the working copy:
https://codepen.io/nabanitadasgupta/pen/aLNGgo

Trying to center naviation bar

I am having problems trying to center the navigation bar on my web page. I tried creating a wrapper div to center it, but it doesn't seem to work. The only thing that works in that div are changing the left margin. Here is the HTML:
body {
background: #bf5c71 url('body-bg.jpg');
}
.clearfix:after {
display: inline-block;
clear: both;
align-content: center;
}
/*----- Menu Outline -----*/
.menu-wrap {
box-shadow: inset 0px 0 0 rgba(255, 255, 255, 0.00);
-webkit-box-shadow: inset 0px 0 0 rgba(255, 255, 255, 0.00);
display: inline-block;
margin: 0px auto;
}
.menu {
display: inline-block;
margin: auto;
}
.menu li {
margin-top: 0px;
margin-right: 0px;
margin-left: 0px;
margin-bottom: 0px;
list-style: none;
font-family: 'Century Gothic';
}
.menu a {
transition: all linear 0.15s;
color: #FF283B;
}
.menu li:hover > a,
.menu .current-item > a {
color: #F5F5F5;
}
.menu .arrow {
font-size: 11px;
line-height: 0%;
}
/*----- Top Level -----*/
.menu > ul > li {
float: left;
display: inline-block;
position: relative;
font-size: 18px;
}
.menu > ul > li > a {
padding-top: 2px;
padding-right: 2px;
padding-left: 2px;
padding-bottom: 2px;
display: inline-block;
text-shadow: 0px 0px 0px rgba(0, 0, 0, 0.00);
}
.menu > ul > li:hover > a,
.menu > ul > .current-item > a {
background: F5F5F5;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index: 1;
opacity: 1;
}
.sub-menu {
width: 100%;
padding: 3px 0px;
position: absolute;
top: 100%;
left: 0px;
z-index: -1;
opacity: 0;
transition: opacity linear 0.15s;
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
background: 0;
}
.sub-menu li {
display: inline-block;
font-size: 16px;
}
.sub-menu li a {
padding-top: 10px;
padding-right: 20px;
padding-left: 20px;
padding-bottom: 5px;
display: inline-block;
}
.sub-menu li a:hover,
.sub-menu .current-item a {
background: #FF283B;
}
img {
border: thin solid #FF283B;
margin-left: 5%;
}
h3 {
margin-top: 3%;
font-size: 24px;
}
.wrapper {
display: inline-block;
margin: 0px auto;
}
<div class="wrapper">
<div class="menu-wrap">
<nav class="menu">
<ul class="clearfix">
<li>
<div align="center">Home</a>
</div>
</li>
<li>
<div align="center">Projects <span class="arrow">▼</span>
<ul class="sub-menu">
<li>Image Adaptation
</li>
<li>Sonic Memory
</li>
<li>Documentary Video
</li>
</ul>
</div>
</li>
<li>
<div align="center">Resume
</div>
</li>
<li>
<div align="center">About
</div>
</li>
<li>
<div align="center">Contact
</div>
</li>
</ul>
</nav>
</div>
</div>
The only thing I can seem to do is just shift the bar left using margin-left.
Website: tylerbr.com
This is enough:
.content {
text-align: center;
}
You need to give your menu a width and change the display to "block"
Here is the style you need to change
.menu-wrap {
box-shadow: 0 0 0 rgba(255, 255, 255, 0) inset;
display: block;
margin: auto;
width: 880px;
}
Its a good idea to give a 100% width to the navbar. And the text-align center on the menu should do the trick.
.menu-wrap {
box-shadow: inset 0px 0 0 rgba(255,255,255,0.00);
-webkit-box-shadow: inset 0px 0 0 rgba(255,255,255,0.00);
display: inline-block;
margin: 0px auto;
width: 100%;
}
.menu {
width: 100%;
display: inline-block;
text-align: center;
}
What you are looking for is they style margin: 0 auto; take a look at this sample code and you will get it.
<style>
.wrapper{
width:100%;
height: 30px;
background: black;
}
.centered_div{
width: 200px;
background: red;
margin:0 auto;
}
</style>
<div class="wrapper">
<div class="centered_div">
test
</div>
</div>

CSS nested menu is not aligned properly

I have a basic nested menustruct:
http://jsfiddle.net/vqnUP/
#topmenu
{
min-height: 54px;
width: 980px;
margin: 0 auto;
background-color: green;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
#topmenu ul
{
list-style-type: none;
margin: 0 0 0 0;
padding: 13px 0 0 0;
color: #fff;
font-size: 1.6em;
}
#topmenu ul li
{
display: inline;
padding: 15px 2.5% 17px 2.5%;
margin: 0 0 0 0;
border-right: 1px solid #000;
box-shadow: 1px 0px 0px #6e6b6b;
position: relative;
}
#topmenu ul li:last-child
{
border: none;
box-shadow: none;
}
#topmenu ul li:first-child
{
border-top-left-radius: 15px;
}
#topmenu ul li img
{
vertical-align: middle;
}
#topmenu a
{
color: #fff;
text-decoration: none;
height: 54px;
}
#topmenu ul li ul{
display: none;
list-style-type: none;
margin: 0 0 0 0;
padding: 13px 0 0 0;
color: #fff;
font-size: 1.6em;
position: absolute;
z-index: 1000;
background-color: red;
}
#topmenu ul li:hover ul{
display: block;
}
#topmenu ul li ul li{
display: block;
padding: 15px 2.5% 17px 2.5%;
margin: 0 0 0 0;
border-right: 1px solid #000;
box-shadow: 1px 0px 0px #6e6b6b;
font-size: 14px;
}
#topmenu ul li ul li:last-child{
border: none;
box-shadow: none;
}
#topmenu ul li ul li:first-child{
border-top-left-radius: 15px;
}
#topmenu ul li ul li img{
vertical-align: middle;
}
<div id="topmenu">
<ul>
<li class=""><a href="home"><img src='/assets/upload/pagemenu/home.png' /></li>
<li class="">Tanßr</li>
<li class="">Dißk</li>
<li class="">SzŘl§</li>
<li class="">Nyelviskola</li>
<li class="">
Boltok
<ul>
<li class="">aaaaaaaa</li>
<li class="">aaaaaaaaa</li>
</ul>
</li>
<li class="">Kapcsolat</li>
<li class="">Linkek</li>
<li class="kiemelt">Webshop</li>
</ul>
<div style="clear: both;"></div></div>
its almost OK, but the submenu in "Boltok" (containing aaaaaaa) doesnt appear excatly under the "Boltok" menu, but aligned to left. I can't figure out the mistake...
I added a top and left to your sub menu
#topmenu ul li ul{
display: none;
list-style-type: none;
margin: 0 0 0 0;
padding: 13px 0 0 0;
color: #fff;
font-size: 1.6em;
position: absolute;
z-index: 1000;
background-color: red;
top: 62px; /* added */
left: 0; /* added */
width: 100%; /* this will cause the submenu to take the 100% width of the containing li - optional? */
};
So we only target the first ul li's you change this class like this. Also added a float: left and changed the display to block
#topmenu > ul > li
{
display: block; float: left;
padding: 15px 2.5% 17px 2.5%;
margin: 0 0 0 0;
border-right: 1px solid #000;
box-shadow: 1px 0px 0px #6e6b6b;
position: relative;
}
Here's the updated fiddle: http://jsfiddle.net/vqnUP/2/
jsFiddle
I'm only addressing the issue you mentioned.
I have just added
width:100%; to #topmenu ul li ul and
text-align:center; to #topmenu ul li ul li.
Hope that helps...

Glow behind the navigation menu

I am creating a little animation with glow in navigation.
Glow is behind the navigation menu as seen in picture.
I tried but not clear result, I need same result as shown in picture.
http://jsfiddle.net/naresh_kumar/GCpDW/5/
HTML
<div id="topnav" style="float:right;">
<ul class="nav clearfix">
<li id="menu-item-6">
Home
</li>
<li id="menu-item-8">
<a>Tutor Videos</a>
</li>
<li id="menu-item-7">
<a>Download Font</a>
</li>
<li id="menu-item-9">
<a>news</a>
</li>
</ul>
</div>
CSS
body{background:#000000;}
ul { margin-left: 20px; padding: 0; }
#topnav {
font-size: 8pt;
font-weight: bold;
margin-top: 2%;
float: left;
font-size: 8pt;
margin-bottom: 0;
margin-left: 63px;
margin-right: 0;
margin-top: 4% !important;
padding: 0;
width: 60%;
}
#topnav ul {
background: none repeat scroll 0 0 #E2E2DE;
border: 3px solid #FFFFFF;
line-height: 1;
list-style: none outside none;
margin: 0;
padding: 0;
}
#topnav ul li {
float: left;
width: auto;
}
#topnav ul li a {
border-bottom: 15px solid transparent;
border-top: 15px solid transparent;
display: block;
line-height: 30px;
margin: -17px 0;
}
#topnav ul a {
color: #000000 !important;
display: block;
line-height: 24px;
padding: 5px 10px;
position: relative;
text-decoration: none;
z-index: 90;
}
#topnav ul a:hover, #topnav ul ul a:hover {
border-color: white;
color: #0A0A0A;
box-shadow: 0 0 50px gold, 0 0 150px gold;
}
.clearfix:after, blockquote:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
.clearfix, blockquote {
display: block;
}
.clearfix, blockquote {
display: inline-block;
}
It's going to be difficult to get the glow 'behind' the menu just using CSS3 but with some minor tweaks (including more subtle use of colour for the glow) you can make the example you have already produced look quite reasonable with the glow on top of the menu
#topnav ul a:hover, #topnav ul ul a:hover {
border-color: white;
color: #0A0A0A;
box-shadow: 0 0 100px #ffffee, 0 0 100px #ffffee;
}

drop down menu css

I have a menu with html and css horizantal and I want to add a vertical menu only for the last element of the menu "parameters"
here is the html code :
<div id="templatemo_menu">
<ul>
<li><span class="home">Acceuil</span></li>
<li><span class="commandes">Commandes</span></li>
<li><span class="users">Utilisateurs</span></li>
<li><span class="gallery">Message</span></li>
<li><span class="contact">Messages</span></li>
<li>
<span class="contact2">Paramétres</span>
<ul class="sousmenu">
<li>CSS</li>
<li>Graphic design</li>
<li>Development tools</li>
<li>Web design</li>
</ul>
</li>
</ul>
</div>
and here is the css code :
#templatemo_menu {
width: 980px;
height: 110px;
margin: 0 auto;
background: url(images/templatemo_menu.jpg) repeat-x;
}
#templatemo_menu ul {
margin: 0;
padding: 1px 40px 0 40px;
list-style: none;
}
#templatemo_menu ul li {
padding: 0px;
margin: 0px;
display: inline;
}
#templatemo_menu ul li a {
float: left;
display: block;
width: 120px;
height: 95px;
padding: 15px 0 0 0;
margin-right: 5px;
text-align: center;
font-size: 16px;
text-decoration: none;
color: #163142;
font-weight: bold;
outline: none;
background: url(images/templatemo_menu_item.jpg) no-repeat;
}
#templatemo_menu li a:hover, #templatemo_menu li .current {
color: #000000;
background: url(images/templatemo_menu_hover.jpg) no-repeat;
}
#templatemo_menu ul li a .home {
display: block;
height: 20px;
padding: 55px 0 0 0;
background: url(images/home_48.png) no-repeat center top;
}
#templatemo_menu ul li a .aboutus {
display: block;
height: 20px;
padding: 55px 0 0 0;
background: url(images/new_order2.png) no-repeat center top;
}
#templatemo_menu ul li a .commandes {
display: block;
height: 20px;
padding: 55px 0 0 0;
background: url(images/commandes_v1.png) no-repeat center top;
}
#templatemo_menu ul li a .users {
display: block;
height: 20px;
padding: 55px 0 0 0;
background: url(images/user.png) no-repeat center top;
}
#templatemo_menu ul li a .services {
display: block;
height: 20px;
padding: 55px 0 0 0;
background: url(images/historiqueCommandes2.png) no-repeat center top;
}
#templatemo_menu ul li a .news {
display: block;
height: 20px;
padding: 55px 0 0 0;
background: url(images/newspaper_48.png) no-repeat center top;
}
#templatemo_menu ul li a .gallery {
display: block;
height: 20px;
padding: 55px 0 0 0;
background: url(images/newMessage.png) no-repeat center top;
}
#templatemo_menu ul li a .contact {
display: block;
height: 20px;
padding: 55px 0 0 0;
background: url(images/mail_48.png) no-repeat center top;
}
(it seems a bit long because I made ​​a template of the website)
so I tried this code css (a drop-down menu) but it not work, I tried to add and delete attributes but no result:
#templatemo_menu .sousMenu
{
display: none;
list-style-type: none;
margin: 0;
padding: 0;
border: 0;
}
#templatemo_menu .sousMenu li
{
float: none;
margin: 0;
padding: 0;
border: 0;
width: 149px;
border-top: 1px solid transparent;
border-right: 1px solid transparent;
}
#templatemo_menu .sousMenu li a:link, #menuDeroulant .sousMenu li a:visited
{
display: block;
color: #FFF;
margin: 0;
border: 0;
text-decoration: none;
background: transparent url("fondTR.png") repeat;
}
#templatemo_menu .sousMenu li a:hover
{
background-image: none;
background-color: #F2462E;
}
#templatemo_menu li:hover > .sousMenu { display: block; }
do you have any idea,thanks
Either in your HTML replace <ul class="sousmenu"> with <ul class="sousMenu">
OR
In your css change .sousmenu with .sousMenu (Everywhere).
Do what you like, but make them equal in cases. And see the difference it makes.