I have got a problem with this dropdown box, I didn't want to keep adding a number at the end of the code because it seemed to be a bit of daunting task to do, but I was wondering if there is a quicker solution to this process, If there is the help would be great, I can't use java script either, the program I am using doesn't like it for some reason.
Many Thanks
/* Dropdown box */
.dropdown {
position: relative;
display: inline-block;
}
.dropdown > input[type="checkbox"] {
position: absolute;
left: -100vw;
}
.dropdown > label,
.dropdown > a[role="button"] {
display: inline-block;
padding: 4px 90px;
color: #fff;
background: #131f6b;
line-height: 1.5em;
text-decoration: none;
border: 2px solid #e03a40;
cursor: pointer;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.dropdown > label:hover,
.dropdown > a[role="button"]:hover,
.dropdown > a[role="button"]:focus {
border-color: #e03a40;
}
.dropdown > label:after,
.dropdown > a[role="button"]:after {
content: "\f0d7";
font-family: FontAwesome;
display: inline-block;
margin-left: 6px;
}
.dropdown > ul {
position: absolute;
z-index: 999;
display: block;
left: -100vw;
top: calc(1.5em + 14px);
border: 2px solid #e03a40;
background: #131f6b;
padding: 6px 0;
margin: 0;
list-style: none;
width: 100%;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 0 3px 8px rgba(0,0,0,.15);
-moz-box-shadow: 0 3px 8px rgba(0,0,0,.15);
box-shadow: 0 3px 8px rgba(0,0,0,.15);
}
.dropdown > ul a {
display: block;
padding: 6px 15px;
text-decoration: none;
color: #ffffff;
}
.dropdown > ul a:hover,
.dropdown > ul a:focus {
background: #50bc08;
}
.dropdown > input[type="checkbox"]:checked ~ ul,
.dropdown > ul:target {
left: 0;
}
.dropdown > [type="checkbox"]:checked + label:after,
.dropdown > ul:target ~ a:after {
content: "\f0d8";
}
.dropdown a.close {
display: none;
}
.dropdown > ul:target ~ a.close {
display: block;
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
text-indent: -100vw;
z-index: 1000;
}
<p class="style2" style="color: #131f6b; text-align: left;"><strong>Example Header</strong></p>
<p class="style2" style="color: #e03a40; text-align: left;"><strong>Example of Product</strong></p>
<div class="dropdown"><input id="my-dropdown" name="my-checkbox" type="checkbox" value="" />
<label for="my-dropdown" data-toggle="dropdown">
Please Select the Document</label>
<ul>
<li>Example Document</li>
</ul>
</div>
Related
The css for my page goes for awhile. There are 2 files which are imported in the head section of my master page. One is the default.css page and the other is menu.css. I tried to add padding and my nav bar flickered over to the right for a split second, but it came right back. I have read in numerous posts about adding space to use padding between the list items but there is a lot of confusing css and classes. I"m not sure which sections of the css will fix the spacing between the menu items
If someone can help me figure this out, that would be terrific. Here is my .css code and html
<header>
<div class="container">
<div class="navbar navbar-static-top">
<div class="navigation">
<nav>
<ul class="nav topnav bold">
<li class="dropdown active">
HOME
</li>
<li class="dropdown">
RESOURCES<i class="icon-angle-down"></i>
<ul style="display: none;" class="dropdown-menu bold">
<li>REVERSE MTG FAQ</li>
<li>OTHER RESOURCES</li>
</ul>
</li>
<li class="dropdown">
OUR PROCESS<i class="icon-angle-down"></i>
<ul style="display: none;" class="dropdown-menu bold">
<li>LOAN PROPOSAL</li>
<li>PROCESSING</li>
</ul>
</li>
<li class="dropdown">
GET QUOTE
</li>
</ul>
</nav>
</div>
<!-- end navigation -->
</div>
</div>
</header>
.css
/* --- header -- */
header {
background: url(../img/menubackground.png) repeat;
margin: 0 0 0 0;
width: 762px;
padding: 10px 0 10px;
border-top-left-radius: 10px 10px;
border-top-right-radius: 10px 10px;
border-bottom-left-radius: 10px 10px;
border-bottom-right-radius: 10px 10px;
position: relative;
z-index: 2000;
text-align: left;
}
/* --- menu --- */
header .navigation {
float: left;
}
header ul.nav li {
border: none;
margin: 0;
}
header ul.nav li a {
border: none;
font-weight: 400;
}
header ul.nav li ul {
z-index: 1000;
margin-top: 1px;
}
header ul.nav li ul li ul {
margin: 1px 0 0 1px;
}
header ul.nav li a i {
color: #fff;
}
.container,
.navbar-static-top .container {
width: 750px;
}
.container {
margin-right: 0;
margin-left: 0;
*zoom: 1;
}
.container:before,
.container:after {
display: table;
line-height: 0;
content: "";
}
.container:after {
clear: both;
}
.dropdown {
position: relative;
}
.nav {
margin-bottom: 20px;
margin-left: 0;
list-style: none;
}
.nav > li > a {
display: block;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #eeeeee;
}
.nav > .dropdown.active > a:hover,
.nav > .dropdown.active > a:focus {
cursor: pointer;
}
.navbar .nav a:hover {
background: #333333;
}
.navbar .nav > .active > a, .navbar .nav > .active > a:hover {
font-weight: 600;
}
.navbar .nav > .active > a:active, .navbar .nav > .active > a:focus {
background: #333333;
outline: 0;
font-weight: 600;
}
.navbar .nav li .dropdown-menu {
z-index: 1000;
}
.navbar .nav {
position: relative;
left: 0;
display: block;
float: left;
margin: 0px 10px 0 0;
}
.navbar .nav > li {
float: left;
}
.navbar .nav > li > a {
float: none;
padding: 2px 15px 2px;
color: #777777;
text-decoration: none;
text-shadow: 0 1px 0 #ffffff;
}
.navbar .nav > li > a:focus,
.navbar .nav > li > a:hover {
color: #333333;
text-decoration: none;
background-color: transparent;
}
.navbar .nav > .active > a,
.navbar .nav > .active > a:hover,
.navbar .nav > .active > a:focus {
color: #555555;
text-decoration: none;
background-color: #e5e5e5;
-webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
-moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
}
.navbar .nav > li > .dropdown-menu:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.navbar .nav > li > .dropdown-menu:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-left: 6px solid transparent;
content: '';
}
.dropdown-menu {
*border-right-width: 0;
*border-bottom-width: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.dropdown-menu .dropdown i {
position: absolute;
right: 0;
margin-top: 3px;
padding-left: 20px;
}
.dropdown-submenu > .dropdown-menu {
-webkit-border-radius: 0 0 0 0;
-moz-border-radius: 0 0 0 0;
border-radius: 0 0 0 0;
}
.navbar .nav {
border-right: none;
border-left: none;
}
.navbar .nav > li > a {
float: none;
font-size: 15px;
margin-left: 0px;
margin-right: 0;
text-decoration: none;
text-shadow: none;
border-right: none;
border-left: none;
color: #fff;
border: 2px solid transparent;
padding: 4px 5px 4px 5px;
background-image: none;
background: none;
}
.navbar .nav > li > a:hover,
.navbar .nav > li > a:focus {
color: #dddddd;
background-color: none;
background-image: none;
background-repeat: repeat-x;
filter: none;
text-decoration: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: 2px solid #302f2f;
padding: 4px 5px 4px 5px;
background: #343434;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-moz-box-shadow: inset 0 0 1px #555;
-webkit-box-shadow: inset 0 0 1px #555;
box-shadow: inset 0 0 1px #555;
}
.navbar .nav > .active > a,
.navbar .nav > .active > a:hover,
.navbar .nav > .active > a:focus {
color: #fff;
border: 2px solid #302f2f;
padding: 4px 10px 4px 10px;
background-image: none;
background: #343434;
filter: none;
text-decoration: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-moz-box-shadow: inset 0 0 1px #555;
-webkit-box-shadow: inset 0 0 1px #555;
box-shadow: inset 0 0 1px #555;
}
.navbar .nav > a i[class^="icon-"] {
color: #fdfdfd;
}
ul.nav li.dropdown a {
z-index: 1000;
display: block;
}
ul.nav li.dropdown ul li ul.dropdown-menu {
margin-left: 0px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}
ul.nav li.dropdown ul li i {
margin-right: 50px;
}
select.selectmenu {
display: none;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 165px;
padding: 0;
margin: 2px 0 0;
list-style: none;
background: #386A57;
border: none;
border: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: 2px solid #302f2f;
border-top: none;
-webkit-background-clip: none;
-moz-background-clip: none;
background-clip: none;
-webkit-border-radius: 0 0 6px 6px;
-moz-border-radius: 0 0 6px 6px;
border-radius: 0 0 6px 6px;
}
.dropdown-menu li {
margin: 0;
padding: 0;
}
.dropdown-menu li a {
color: #ddd;
font-size: 15px;
padding: 5px 7px 5px 7px;
margin: 0;
text-shadow: none;
border-bottom: 1px solid #303030;
text-decoration: none;
}
.dropdown-menu li > a:hover,
.dropdown-menu li > a:focus,
.dropdown-submenu:hover > a,
.dropdown-menu .active > a,
.dropdown-menu .active > a:hover {
color: #ffffff;
text-decoration: none;
background-image: none;
background-image: none;
background-image: none;
background-image: none;
background-image: none;
background-repeat:inherit;
filter: none;
}
.dropdown-menu .sub-menu-level1, .dropdown-menu .sub-menu-level2 {
left: 100%;
position: absolute;
top: 0;
visibility: hidden;
margin-top: 0;
}
.dropdown-menu li:hover .sub-menu-level1 {
visibility: visible;
}
.dropdown-menu li li:hover .sub-menu-level2 {
visibility: visible;
}
I need to create a 3 second delay for the following class: .mag-megamenu .dropdown.mag-megamenu-fw .dropdown-menu
I would like to use the solution found here for a similar question: https://stackoverflow.com/a/6943704/3684265
However I'm having an issue finding the correct hover class to apply the visibility and opacity styles to. I have applied visibility, opacity and transition to .mag-megamenu .dropdown.mag-megamenu-fw which works to hide it the drop down, but when I hover over the main navigation items the dropdown doesn't appear.
Full stylesheet is below for reference:
//
// Common
// _____________________________________________
& when (#media-common = true) {
.mag-megamenu .dropdown a, .mag-megamenu .dropdown-menu a {
color: #656565;
}
.mag-megamenu .dropdown-menu > li > a {
padding: 6px 15px;
}
.mag-megamenu .navbar-nav > li .dropdown-menu {
border: 1px solid #d1d1d1;
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.19);
}
.mag-megamenu i {
color: #bfbfbf;
}
.mag-megamenu .dropdown:hover > .dropdown-menu {
margin-top: 0;
}
.mag-megamenu .dropdown-menu {
border: 1px solid #efefef;
box-shadow: none;
padding: 0;
}
.mag-megamenu .form-control {
border: 1px solid #efefef;
margin-top: 10px;
}
.mag-megamenu .btn {
margin: 10px 0 20px;
}
.mag-megamenu video {
height: auto;
max-width: 100%;
}
.mag-megamenu iframe, .mag-megamenu embed, .mag-megamenu object {
max-width: 100%;
}
.mag-megamenu .dropdown-menu .withoutdesc {
display: block;
margin-top: 0;
padding: 15px 20px;
text-align: left;
text-transform: none;
width: 100%;
}
.mag-megamenu a:hover {
text-decoration: none;
}
.mag-megamenu .dropdown-menu .withoutdesc ul li {
padding: 3px 10px;
}
.mag-megamenu .dropdown-menu .withoutdesc ul li:hover, .mag-megamenu .dropdown-menu .withoutdesc ul li:focus {
background-color: #f5f5f5 !important;
color: #262626;
text-decoration: none;
}
.mag-megamenu .dropdown-menu .withoutdesc li:last-child {
border-bottom: 0 solid #fff;
}
.mag-megamenu .mag-megamenu-content.withdesc a::after {
color: #cfcfcf;
content: attr(data-description);
display: block;
font-size: 11px;
font-weight: 400;
line-height: 0;
text-transform: uppercase;
}
.mag-megamenu .dropdown-submenu {
position: relative;
}
.mag-megamenu .dropdown-submenu > .dropdown-menu {
left: 100%;
margin-left: -1px;
margin-top: 0;
top: 0;
transition-delay: 2s;
}
.mag-megamenu .dropdown-submenu:hover > .dropdown-menu {
display: block;
}
.mag-megamenu .dropdown-submenu > a::after {
border-color: transparent transparent transparent #cccccc;
border-style: solid;
border-width: 5px 0 5px 5px;
display: block;
float: right;
height: 0;
margin-right: -10px;
margin-top: 5px;
width: 0;
}
.mag-megamenu .dropdown-submenu:hover > a::after {
border-left-color: #ffffff;
}
.mag-megamenu .dropdown-submenu.pull-left {
float: none;
}
.mag-megamenu .dropdown-submenu.pull-left > .dropdown-menu {
left: -100%;
margin-left: 10px;
}
.mag-megamenu p {
color: #656565;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 13px;
}
.mag-megamenu .nav, .mag-megamenu .collapse, .mag-megamenu .dropup, .mag-megamenu .dropdown {
position: static;
}
.mag-megamenu .half {
left: auto !important;
right: auto !important;
width: 50%;
}
.mag-megamenu .container {
position: relative;
}
.mag-megamenu .dropdown-menu {
left: auto;
}
.mag-megamenu .nav.navbar-right .dropdown-menu {
left: auto;
right: 0;
}
.mag-megamenu .mag-megamenu-content {
padding: 15px 25px;
}
.mag-megamenu .dropdown.mag-megamenu-fw .dropdown-menu {
left: 0 !important;
right: 0;
overflow: auto;
max-height: 500px;
position: absolute;
background-color: #fff;
z-index: 9999;
visibility: hidden;
opacity: 0;
transition: visibility 0s, opacity 3s linear;
}
.mag-megamenu .dropdown.mag-megamenu-fw {
position: initial !important;
}
.mag-megamenu .title {
border-bottom: 1px solid #efefef;
font-size: 13px;
font-weight: bold;
margin-top: 15px;
padding-bottom: 10px;
text-transform: uppercase;
}
.mag-megamenu ul {
list-style: outside none none;
padding-left: 0;
}
.mag-megamenu ul > li {
margin-bottom:0px;
}
.mag-megamenu .navbar-nav > li .dropdown-menu {
display: none;
}
ul.dropdown-menu.fullwidth li.mag-megamenu-content ul {
display: block !important;
}
ul.dropdown-menu.fullwidth li.mag-megamenu-content ul li{
font-weight: 400;
padding-bottom: 10px;
}
.label {
padding: 3px 10px;
font-size: 1.2rem;
font-weight: 300;
border-radius: 2px;
&-info {
border: 1px solid #d9534f;
color: #ffffff;
background-color: #d9534f;
}
&-danger {
border: 1px solid #ffbb20;
color: #ffffff;
background-color: #ffbb20;
}
&-success {
border: 1px solid #5cb85c;
color: #ffffff;
background-color: #5cb85c;
}
}
}
.media-width(#extremum, #break) when (#extremum = 'max') and (#break = #screen__m) {
.mag-megamenu .mag-megamenu-content {
padding: 0px;
}
ul.dropdown-menu.fullwidth li.ui-menu-item.all-category {
display: none !important;
}
}
Have to convert this horizontal navigation bar with button in place of anchor tags and let it behave and look the same way
https://codepen.io/shaswat/pen/GOrpKX
ever anchor tag should be removed and should be replaced with a button like <input type=button >
so it can look like a navigation bar
/* Menu CSS */
#cssmenu,
#cssmenu>ul {
background: black;
padding-bottom: 3px;
border-radius: 5px 5px 5px 5px;
}
#cssmenu:before,
#cssmenu:after,
#cssmenu>ul:before,
#cssmenu>ul:after {
content: "";
display: table;
box-sizing: border-box;
}
#cssmenu:after,
#cssmenu>ul:after {
clear: both;
}
#cssmenu {
width: auto;
zoom: 1;
}
#cssmenu>ul {
background: blue;
margin: 0;
padding: 0;
position: relative;
}
<div id='cssmenu'>
<ul>
<li><a href='#'>Home</a>
<ul>
<li><a href='#'>Product 1</a></li>
<li><a href='#'>Product 2</a></li>
<li><a href='#'>Product 3</a></li>
</ul>
</li>
<li><a class='active' href='#'>Products</a>
</li>
<li><a href='#'>About</a>
</li>
<li><a href='#'>Contact</a></li>
</ul>
</div>
Its just a matter of css if i understood what you wanted to do right:
https://codepen.io/anon/pen/JOENRY
/* Menu CSS */#cssmenu,
#cssmenu > ul {
background: black;
padding-bottom: 3px;
border-radius: 5px 5px 5px 5px;
}
#cssmenu:before,
#cssmenu:after,
#cssmenu > ul:before,
#cssmenu > ul:after {
content: "";
display: table;
box-sizing: border-box;
}
#cssmenu:after,
#cssmenu > ul:after {
clear: both;
}
#cssmenu {
width: auto;
zoom: 1;
}
#cssmenu > ul {
background: blue;
margin: 0;
padding: 0;
position: relative;
}
#cssmenu > ul li {
margin: 0;
padding: 0;
list-style: none;
}
#cssmenu > ul > li {
float: left;
position: relative;
}
#cssmenu button {
background-color: transparent;
border: 0px;
}
#cssmenu > ul > li > button {
padding: 15px 25px;
display: block;
color: white;
font-size: 13px;
text-decoration: none;
text-shadow: 0 -1px 0 #0d0d0d;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.7);
}
#cssmenu > ul > li:hover > button {
background: red;
text-shadow: 0 -1px 0 #97321f;
text-shadow: 0 -1px 0 rgba(122, 42, 26, 0.64);
}
#cssmenu > ul > li.active > button,
#cssmenu > ul > li > button.active {
background: black;
}
/* Childs */
#cssmenu > ul ul {
opacity: 0;
visibility: hidden;
position: absolute;
top: 50px;
background: green;
margin: 0;
padding: 0;
z-index: -1;
box-shadow: 5px 5px 5px #808080;
}
#cssmenu > ul li:hover ul {
opacity: 1;
visibility: visible;
margin: 0;
color: #000;
z-index: 2;
top: 50px;
left: 0;
}
#cssmenu > ul ul:before {
content: "";
position: absolute;
top: -10px;
width: 100%;
height: 18px;
background: transparent;
}
#cssmenu > ul ul li {
list-style: none;
padding: 0;
margin: 0;
width: 100%;
}
#cssmenu > ul ul li button {
padding: 15px 26px;
display: block;
color: white;
font-size: 14px;
text-decoration: none;
width: 150px;
border-left: 4px solid transparent;
-webkit-transition: all 0.50s ease-in-out;
-moz-transition: all 0.50s ease-in-out;
-ms-transition: all 0.50s ease-in-out;
transition: all 0.50s ease-in-out;
}
#cssmenu > ul ul li button:hover {
border-left: 10px solid #d64e34;
background: grey;
}
#cssmenu > ul ul li button:active {
background: green;
}
#cssmenu li button:first-child:nth-last-child(2):before {
content:"";
position: absolute;
height:0;
width: 0;
border: 8px solid transparent;
border-top-color: orange;
top: 40% ;
right:5px;
}
#cssmenu li:hover > button:first-child:nth-last-child(2):before {
border: 8px solid transparent;
border-bottom-color: orange;
margin-top:-6px
}
<div id='cssmenu'>
<ul>
<li ><button href='#'>Home</button>
<ul>
<li><button href='#'>Product 1</button></li>
<li><button href='#'>Product 2</button></li>
<li><button href='#'>Product 3</button></li>
</ul>
</li>
<li><button class='active' href='#'>Products</button>
</li>
<li><button href='#'>About</button>
</li>
<li><button href='#'>Contact</button></li>
</ul>
</div>
try this code
/* Menu CSS */
#cssmenu,
#cssmenu>ul {
// background: black;
padding-bottom: 3px;
border-radius: 5px 5px 5px 5px;
}
#cssmenu:before,
#cssmenu:after,
#cssmenu>ul:before,
#cssmenu>ul:after {
content: "";
display: table;
box-sizing: border-box;
}
#cssmenu:after,
#cssmenu>ul:after {
clear: both;
}
#cssmenu {
width: auto;
zoom: 1;
}
#cssmenu>ul {
//background: blue;
margin: 0;
padding: 0;
position: relative;
}
#cssmenu>ul ul {
opacity: 0;
visibility: hidden;
position: absolute;
top: 10px;
margin: 0;
padding: 0;
z-index: -1;
//box-shadow: 5px 5px 5px #808080;
display: block;
}
#cssmenu>ul li {
display: inline;
}
#cssmenu>ul li input {
text-decoration: none;
padding: 7px;
background-color: red;
border: none;
}
#cssmenu>ul li:hover ul {
opacity: 1;
visibility: visible;
margin: 0;
color: #000;
z-index: 2;
top: 32px;
left: 0;
display: block !important;
}
#cssmenu>ul ul li input {
padding: 15px 26px;
display: block;
color: white;
font-size: 14px;
text-decoration: none;
width: 150px;
}
<div id='cssmenu'>
<ul>
<li><input type="button" value="Home">
<ul>
<li><input type="button" value="Product 1"></li>
<li><input type="button" value="Product 2"></li>
<li><input type="button" value="Product 3"></li>
</ul>
</li>
<li><input type="button" value="Products">
</li>
<li><input type="button" value="About">
</li>
<li><input type="button" value="Contact"></li>
</ul>
</div>
I just replaced a with button in html and css and added a button css tag (dont use it like this use a class instead this is for presentation purpose only). I gave bg color of blue to buttons and removed thier white border . Instead of href use onclick event and append them addEventlistner to tinker with them. Thought i wont recommend using buttons here but here you go.
/* Menu CSS */
#cssmenu,
#cssmenu>ul {
background: black;
padding-bottom: 3px;
border-radius: 5px 5px 5px 5px;
}
#cssmenu:before,
#cssmenu:after,
#cssmenu>ul:before,
#cssmenu>ul:after {
content: "";
display: table;
box-sizing: border-box;
}
#cssmenu:after,
#cssmenu>ul:after {
clear: both;
}
#cssmenu {
width: auto;
zoom: 1;
}
#cssmenu>ul {
background: blue;
margin: 0;
padding: 0;
position: relative;
}
#cssmenu>ul li {
margin: 0;
padding: 0;
list-style: none;
}
#cssmenu>ul>li {
float: left;
position: relative;
}
#cssmenu>ul>li>a {
padding: 15px 25px;
display: block;
color: white;
font-size: 13px;
text-decoration: none;
text-shadow: 0 -1px 0 #0d0d0d;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.7);
}
#cssmenu>ul>li:hover>a {
background: red;
text-shadow: 0 -1px 0 #97321f;
text-shadow: 0 -1px 0 rgba(122, 42, 26, 0.64);
}
#cssmenu>ul>li.active>a,
#cssmenu>ul>li>a.active {
background: black;
}
/* Childs */
#cssmenu>ul ul {
opacity: 0;
visibility: hidden;
position: absolute;
top: 50px;
background: green;
margin: 0;
padding: 0;
z-index: -1;
box-shadow: 5px 5px 5px #808080;
}
#cssmenu>ul li:hover ul {
opacity: 1;
visibility: visible;
margin: 0;
color: #000;
z-index: 2;
top: 50px;
left: 0;
}
#cssmenu>ul ul:before {
content: "";
position: absolute;
top: -10px;
width: 100%;
height: 18px;
background: transparent;
}
#cssmenu>ul ul li {
list-style: none;
padding: 0;
margin: 0;
width: 100%;
}
#cssmenu>ul ul li a {
padding: 15px 26px;
display: block;
color: white;
font-size: 14px;
text-decoration: none;
width: 150px;
border-left: 4px solid transparent;
-webkit-transition: all 0.50s ease-in-out;
-moz-transition: all 0.50s ease-in-out;
-ms-transition: all 0.50s ease-in-out;
transition: all 0.50s ease-in-out;
}
#cssmenu>ul ul li a:hover {
border-left: 10px solid #d64e34;
background: grey;
}
#cssmenu>ul ul li a:active {
background: green;
}
#cssmenu li a:first-child:nth-last-child(2):before {
content: "";
position: absolute;
height: 0;
width: 0;
border: 8px solid transparent;
border-top-color: orange;
top: 40%;
right: 5px;
}
#cssmenu li:hover>a:first-child:nth-last-child(2):before {
border: 8px solid transparent;
border-bottom-color: orange;
margin-top: -6px
}
<div id='cssmenu'>
<ul>
<li><button>Home</button>
<ul>
<li><button>Product 1</button></li>
<li><button>Product 2</button></li>
<li><button>Product 3</button></li>
</ul>
</li>
<li><button class='active'>Products</button>
</li>
<li><button>About</button>
</li>
<li><button>Contact</button></li>
</ul>
</div>
This question already has answers here:
How to make this arrow in CSS only?
(5 answers)
Closed 6 years ago.
How can i achieve the effect in the below image using css
parent div with divs with triangle egde like in the picture below. if i can achieve this with JS am also open to any good idea
* {
margin: 0;
}
a {
color: #333;
text-decoration: none;
}
nav {
background: #eee;
overflow: hidden;
}
nav li {
display: inline-block;
vertical-align: top;
position: relative;
}
nav li:after {
content: " ";
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 40px;
transform: rotate(45deg);
background: #999;
}
nav a {
display: block;
padding: 14px 20px;
position: relative;
z-index: 1;
}
nav li a:before {
content: " ";
position: absolute;
right: 3px;
top: 0;
bottom: 0;
width: 40px;
transform: rotate(45deg);
background: #eee;
z-index: -1;
}
<nav>
<ul>
<li>Jewelry and watches
</li>
<li>watches
</li>
<li>Jewelry
</li>
<li>Wrist watches
</li>
</ul>
</nav>
Or you can even simplify it by using one psudo element and using the border property
* {
margin: 0;
}
a {
color: #333;
text-decoration: none;
}
nav {
background: #eee;
overflow: hidden;
box-shadow: 0px 0px 3px 2px rgba(0,0,0,0.25);
margin: 15px;
}
nav li {
display: inline-block;
vertical-align: top;
position: relative;
}
nav li:after {
content: " ";
position: absolute;
right: 0px;
top: -1px;
bottom: 0;
width: 30px;
transform: rotate(45deg);
background: transparent;
height: 30px;
border-right: 1px solid #999;
border-top: 1px solid #999;
}
nav a {
display: block;
padding: 5px 20px;
position: relative;
z-index: 1;
}
<nav>
<ul>
<li>Jewelry and watches
</li>
<li>watches
</li>
<li>Jewelry
</li>
<li>Wrist watches
</li>
</ul>
</nav>
Try this one
HTML
<ul class="breadcrumb">
<li>Home</li>
<li>Vehicles</li>
<li>Vans</li>
<li>Camper Vans</li>
<li>1989 VW Westfalia Vanagon</li>
</ul>
CSS
.breadcrumb {
list-style: none;
overflow: hidden;
font: 18px Helvetica, Arial, Sans-Serif;
}
.breadcrumb li {
float: left;
}
.breadcrumb li a {
color: white;
text-decoration: none;
padding: 10px 0 10px 65px;
background: brown; /* fallback color */
background: hsla(34,85%,35%,1);
position: relative;
display: block;
float: left;
}
.breadcrumb li a:after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
border-bottom: 50px solid transparent;
border-left: 30px solid hsla(34,85%,35%,1);
position: absolute;
top: 50%;
margin-top: -50px;
left: 100%;
z-index: 2;
}
.breadcrumb li a:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid white;
position: absolute;
top: 50%;
margin-top: -50px;
margin-left: 1px;
left: 100%;
z-index: 1;
}
.breadcrumb li:first-child a {
padding-left: 10px;
}
.breadcrumb li:nth-child(2) a { background: hsla(34,85%,45%,1); }
.breadcrumb li:nth-child(2) a:after { border-left-color: hsla(34,85%,45%,1); }
.breadcrumb li:nth-child(3) a { background: hsla(34,85%,55%,1); }
.breadcrumb li:nth-child(3) a:after { border-left-color: hsla(34,85%,55%,1); }
.breadcrumb li:nth-child(4) a { background: hsla(34,85%,65%,1); }
.breadcrumb li:nth-child(4) a:after { border-left-color: hsla(34,85%,65%,1); }
.breadcrumb li:nth-child(5) a { background: hsla(34,85%,75%,1); }
.breadcrumb li:nth-child(5) a:after { border-left-color: hsla(34,85%,75%,1); }
.breadcrumb li:last-child a {
background: transparent !important;
color: black;
pointer-events: none;
cursor: default;
}
.breadcrumb li a:hover { background: hsla(34,85%,25%,1); }
.breadcrumb li a:hover:after { border-left-color: hsla(34,85%,25%,1) !important; }
I've been trying to solve this problem for quite some time now. I need my navigation to be responsive. By responsive, i need my nav to still show its links when minimized and dragged to the very left. What my code does now is that the links disappear as if there is no nav bar at all when minimized. Thank you in advance!
Normal view (which is also how i need my nav to look like when minimized)
Current minimized window
Here is my drop down menu code for our CSS:
#menu, #menu ul {
margin: 0;
padding: 0;
list-style: none;
}
#menu {
width: 800px;
margin: 60px auto;
margin-top: -30px;
margin-bottom: 10px;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
background-color: #ffffff;/*bg color of drop down menu*/
}
#menu:before,
#menu:after {
content: "";
display: table;
}
#menu:after {
clear: both;
}
#menu {
zoom:1;
}
#menu li {
float: left;
position: relative;
}
#menu a {
float: left;
padding: 12px 30px;
color: #999; /* home my acct etc */
text-transform: uppercase;
font-family: 'Quicksand', sans-serif;
text-decoration: none;
}
#menu li:hover > a { /*font color of nav while hover */
color: #000000;
background: #FFE87C; /* blue */
}
*html #menu li a:hover { /* IE6 only */
color: #000000;
}
#menu ul {
margin: 20px 0 0 0;
_margin: 0; /*IE6 only*/
opacity: 0;
visibility: hidden;
position: absolute;
top: 38px;
left: 0;
z-index: 1;
background:#FFE87C; /* bg color ng drop down yellow */
box-shadow: 0 -1px 0 rgba(255,255,255,.3);
border-radius: 3px;
transition: all .2s ease-in-out;
}
#menu li:hover > ul {
opacity: 1;
visibility: visible;
margin: 0;
}
#menu ul ul {
top: 0;
left: 150px;
margin: 0 0 0 20px;
_margin: 0; /*IE6 only*/
box-shadow: -1px 0 0 rgba(255,255,255,.3);
}
#menu ul li {
float: none;
display: block;
border: 0;
_line-height: 0; /*IE6 only*/
}
#menu ul li:last-child {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
#menu ul a {
padding: 10px;
width: auto;
_height: 10px; /*IE6 only*/
display: block;
white-space: nowrap;
float: none;
text-transform: none;
color: black; /* font color of drop down */
}
#menu ul a:hover {
background-color: #EDDA74;/*hover of link blue*/
color:#000000;
}
#menu ul li:first-child > a {
border-radius: 3px 3px 0 0;
}
#menu ul li:first-child > a:after {
content: '';
position: absolute;
left: 40px;
top: -6px;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #D1D0CE;
}
#menu ul ul li:first-child a:after {
left: -6px;
top: 50%;
margin-top: -6px;
border-left: 0;
border-bottom: 6px solid transparent;
border-top: 6px solid transparent;
border-right: 6px solid #D1D0CE;
}
#menu ul li:first-child a:hover:after {
border-bottom-color: #04acec;
}
#menu ul ul li:first-child a:hover:after {
border-right-color: #0299d3;
border-bottom-color: transparent;
}
#menu ul li:last-child > a {
-moz-border-radius: 0 0 3px 3px;
-webkit-border-radius: 0 0 3px 3px;
border-radius: 0 0 3px 3px;
}
#media screen and (max-width: 600px) {
/* nav-wrap */
#menu-wrap {
position: relative;
}
#menu-wrap * {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* menu icon */
#menu-trigger {
display: block; /* show menu icon */
height: 40px;
line-height: 40px;
cursor: pointer;
padding: 0 0 0 35px;
border: 1px solid #222;
color: #fafafa;
background-color: #111;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAPCAMAAADeWG8gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjE2QjAxNjRDOUNEOTExRTE4RTNFRkI1RDQ2MUYxOTQ3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjE2QjAxNjREOUNEOTExRTE4RTNFRkI1RDQ2MUYxOTQ3Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MTZCMDE2NEE5Q0Q5MTFFMThFM0VGQjVENDYxRjE5NDciIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MTZCMDE2NEI5Q0Q5MTFFMThFM0VGQjVENDYxRjE5NDciLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz42AEtnAAAABlBMVEX///////9VfPVsAAAAAnRSTlP/AOW3MEoAAAAWSURBVHjaYmAgFzBiACKFho6NAAEGAD07AG1pn932AAAAAElFTkSuQmCC) no-repeat 10px center, linear-gradient(#444, #111);
border-radius: 6px;
box-shadow: 0 1px 1px #777, 0 1px 0 #666 inset;
}
/* main nav */
#menu {
margin: 0; padding: 10px;
position: absolute;
top: 40px;
width: 100%;
z-index: 1;
background-color: #48CCCD;
display: none;
box-shadow: none;
}
#menu:after {
content: '';
position: absolute;
left: 25px;
top: -8px;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #444;
}
#menu ul {
position: static;
visibility: visible;
opacity: 1;
margin: 0;
background: none;
box-shadow: none;
}
#menu ul ul {
margin: 0 0 0 20px !important;
box-shadow: none;
}
#menu li {
position: static;
display: block;
float: none;
border: 0;
margin: 5px;
box-shadow: none;
}
#menu ul li{
margin-left: 20px;
box-shadow: none;
}
#menu a{
display: block;
float: none;
padding: 0;
color: #999;
}
#menu a:hover{
color: #fafafa;
}
#menu ul a{
padding: 0;
width: auto;
}
#menu ul a:hover{
background: none;
}
#menu ul li:first-child a:after,
#menu ul ul li:first-child a:after {
border: 0;
}
}
I think you should try to set the "html, body" tags in your CSS with min-width: x% / xpx, x being your choice, e.g. min-width: 700px or min-width: 75%