Ive been trying to put in this image but the issue i'm getting here is that the image keeps on passing the footer and I cant seem to solve it. Please help me out. The image size for the "batmanshop" is width=890 and height=2000.
Here is the CSS code and below is the HTML code
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background-image: url(images/background.png);
margin: 0;
padding: 0;
color: #000;
}
IMG.titleImage {
margin-left: 300px;
}
ul, ol, dl {
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0;
padding-right: 15px;
padding-left: 15px;
word-wrap: break-word;
}
a img {
border: none;
}
a:link {
color: black;
}
a:visited {
color: #6E6C64;
}
a:hover, a:active, a:focus {
text-decoration: none;
}
.container {
width: 960px;
height:100%;
background-color: #FFF;
margin: 0 auto;
}
.header {
background-image:url(images/headerbg.png);
height:140px;
}
.content {
width:100%;
height:100%;
background-color: white;
}
.footer {
padding: 10px 0;
background-color: #F1F8E0;
}
.fltrt {
float: right;
margin-left: 8px;
}
.fltlft {
float: left;
margin-right: 8px;
}
.clearfloat {
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
//Navigation Bar
.nav, .nav ul {
margin: 0;
padding: 0;
list-style: none;
line-height: 1;
}
.nav {
/* Layout & positioning */
position: relative;
margin: auto; /* Centering the menu */
height: 46px;
width: 960px;
text-align: center;
/* Background & effects */
box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
background: #65c0bb;
background-image:url(images/navImage.png);
}
.nav>li {
margin: 0;
line-height: 1;
padding: 0;
display: inline;
position: relative;
margin: 0 12px;
}
.nav::after, .nav::before {
content: "";
display: block;
position: absolute;
top: 6px;
height: 0px;
width: 0px;
border: 23px solid #65c0bb;
z-index: -1;
}
/* The left ribbon */
.nav::before {
border-left-color: transparent;
left: -30px;
}
/* The right ribbon */
.nav::after {
border-right-color: transparent;
right: -30px;
}
.nav>li>a {
display: inline-block;
padding: 15px 20px;
position: relative;
font-family: 'Oswald', sans-serif;
font-size: 16px;
text-transform: uppercase;
text-decoration: none;
color: #fff;
-webkit-transition: color .3s linear;
-moz-transition: color .3s linear;
-o-transition: color .3s linear;
-ms-transition: color .3s linear;
transition: color .3s linear;
}
.nav>li>a:hover, .nav>li:hover>a {
color: #eae8a5;
}
.nav>li>a::after {
content: "";
height: 15px;
width: 15px;
position: absolute;
right: -20px;
top: 16px;
display: block;
}
.nav>li:last-child>a::after {
display: none;
}
.nav ul {
position: absolute;
left: -9999px;
padding-top: 10px;
border-bottom: 1px solid #ccc;
opacity: 0;
-webkit-transition: opacity .3s linear;
-moz-transition: opacity .3s linear;
-o-transition: opacity .3s linear;
-ms-transition: opacity .3s linear;
}
.nav>li:hover>ul {
left: 0;
opacity: 1;
top: 30px;
}
.nav ul li:hover>ul {
left: 150px;
opacity: 1;
top: -11px;
padding-left: 12px;
border-bottom: 0;
box-shadow: none;
}
.nav ul li {
display: block;
position: relative;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
width: 150px;
text-align: justify;
z-index: 9;
background: #eee;
box-shadow: 3px 4px 0 rgba(0, 0, 0, .1);
-webkit-transition: background .3s linear;
-moz-transition: background .3s linear;
-ms-transition: background .3s linear;
-o-transition: background .3s linear;
}
.nav ul li a {
font-family: "Oswald", sans-serif;
font-size: 14px;
text-decoration: none;
display: block;
padding: 7px 12px 7px 20px;
color: #65c0bb;
-webkit-transition: color .3s linear;
-moz-transition: color .3s linear;
-ms-transition: color .3s linear;
-o-transition: color .3s linear;
}
.nav ul li:hover>a, .nav ul li a:hover {
color: #4db6b0;
}
.nav ul li:hover {
background: #f7f7f7;
}
.nav ul ul li:last-child {
border-bottom: 1px solid #ccc;
}
.nav ul ul li {
box-shadow: 3px 3px 0 rgba(0, 0, 0, .1);
}
.nav ul::after, .nav ul::before {
content: "";
display: block;
z-index: 1;
position: absolute;
height: 9px;
width: 9px;
}
.nav>li>ul::after {
border: 1px solid #ccc;
background: #eee;
border-right: 0;
border-bottom: 0;
top: 5px;
left: 25px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-ms-transform: rotate(45deg);
}
.nav>li>ul::before {
height: 1px;
width: 12px;
background: #eee;
border-right: 0;
border-bottom: 0;
top: 10px;
left: 24px;
z-index: 99;
}
.nav ul ul::after {
border: 1px solid #ccc;
background: #eee;
border-right: 0;
border-bottom: 0;
top: 20px;
left: 8px;
position: absolute;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
}
.nav ul ul::before {
height: 10px;
width: 1px;
background: #eee;
z-index: 99;
top: 20px;
left: 12px;
}
.titleImage2 {
margin-left: 250px;
}
.birthdayDream {
padding-right: 15px;
padding-left: 15px;
float: right;
}
p1 {
display: block;
margin-top: 30px;
padding-right: 15px;
padding-left: 15px;
}
form {
margin-left: auto;
margin-right: auto;s
display:inline-block;
width:600px;
}
input {
float:right;
margin-right: 50px;
clear:both;
}
input2 {
float:left;
}
.row {
margin-left: 200px;
}
.batmanImage {
margin-left: 180px;
}
.batmanshop {
height:auto;
margin: 0 auto;
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="style.css">
<title>Birthday Planner - Home</title>
</head>
<body>
<div class="container">
<div class="header">
</div>
<ul class="nav">
<li>
Home
</li>
<li>
Themes
<ul>
<li>Boys Party Theme</li>
<li>Girls Party Theme</li>
</ul>
</li>
<li>About</li>
<li>Contact</li>
<li>Login</li>
<li>Sign Up</li>
</ul>
<div class="content">
<br/>
<IMG class="batmanImage">
<img src="images/batmantitle.jpg" name="Title" width="600" height="206">
</IMG>
<p>All you need to do is select the desired theme and provide us the necessary details. We will do the rest. The items listed below are what will be provided when you order this theme. Don't need to worry about anything else. Just a click of a button and we will get our team to handle the rest for you.
</p>
<IMG class="batmanshop">
<img src="images/batmanshop.jpg" name="Title">
</IMG>
</div>
<div class="footer">
<div class="navigationbar">
<ul class="nav">
<li>
Home
</li>
<li>
About
</li>
<li>
Contact
</li>
<li>
Terms and Conditions
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
Whatever you want to achieve, you can not do that :
<IMG class="batmanshop">
<img src="images/batmanshop.jpg" name="Title">
</IMG>
I replaced that by: <img class="batmanshop" src="images/batmanshop.jpg" name="Title" />
Anyway, even with your code, I do not see the image passing over the footer.
body {
font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
background-image: url(images/background.png);
margin: 0;
padding: 0;
color: #000;
}
IMG.titleImage {
margin-left: 300px;
}
ul, ol, dl {
padding: 0;
margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
margin-top: 0;
padding-right: 15px;
padding-left: 15px;
word-wrap: break-word;
}
a img {
border: none;
}
a:link {
color: black;
}
a:visited {
color: #6E6C64;
}
a:hover, a:active, a:focus {
text-decoration: none;
}
.container {
width: 960px;
height:100%;
background-color: #FFF;
margin: 0 auto;
}
.header {
background-image:url(images/headerbg.png);
height:140px;
}
.content {
width:100%;
height:100%;
background-color: white;
}
.footer {
padding: 10px 0;
background-color: #F1F8E0;
}
.fltrt {
float: right;
margin-left: 8px;
}
.fltlft {
float: left;
margin-right: 8px;
}
.clearfloat {
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
//Navigation Bar
.nav, .nav ul {
margin: 0;
padding: 0;
list-style: none;
line-height: 1;
}
.nav {
/* Layout & positioning */
position: relative;
margin: auto; /* Centering the menu */
height: 46px;
width: 960px;
text-align: center;
/* Background & effects */
box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
background: #65c0bb;
background-image:url(images/navImage.png);
}
.nav>li {
margin: 0;
line-height: 1;
padding: 0;
display: inline;
position: relative;
margin: 0 12px;
}
.nav::after, .nav::before {
content: "";
display: block;
position: absolute;
top: 6px;
height: 0px;
width: 0px;
border: 23px solid #65c0bb;
z-index: -1;
}
/* The left ribbon */
.nav::before {
border-left-color: transparent;
left: -30px;
}
/* The right ribbon */
.nav::after {
border-right-color: transparent;
right: -30px;
}
.nav>li>a {
display: inline-block;
padding: 15px 20px;
position: relative;
font-family: 'Oswald', sans-serif;
font-size: 16px;
text-transform: uppercase;
text-decoration: none;
color: #fff;
-webkit-transition: color .3s linear;
-moz-transition: color .3s linear;
-o-transition: color .3s linear;
-ms-transition: color .3s linear;
transition: color .3s linear;
}
.nav>li>a:hover, .nav>li:hover>a {
color: #eae8a5;
}
.nav>li>a::after {
content: "";
height: 15px;
width: 15px;
position: absolute;
right: -20px;
top: 16px;
display: block;
}
.nav>li:last-child>a::after {
display: none;
}
.nav ul {
position: absolute;
left: -9999px;
padding-top: 10px;
border-bottom: 1px solid #ccc;
opacity: 0;
-webkit-transition: opacity .3s linear;
-moz-transition: opacity .3s linear;
-o-transition: opacity .3s linear;
-ms-transition: opacity .3s linear;
}
.nav>li:hover>ul {
left: 0;
opacity: 1;
top: 30px;
}
.nav ul li:hover>ul {
left: 150px;
opacity: 1;
top: -11px;
padding-left: 12px;
border-bottom: 0;
box-shadow: none;
}
.nav ul li {
display: block;
position: relative;
border-top: 1px solid #ccc;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
width: 150px;
text-align: justify;
z-index: 9;
background: #eee;
box-shadow: 3px 4px 0 rgba(0, 0, 0, .1);
-webkit-transition: background .3s linear;
-moz-transition: background .3s linear;
-ms-transition: background .3s linear;
-o-transition: background .3s linear;
}
.nav ul li a {
font-family: "Oswald", sans-serif;
font-size: 14px;
text-decoration: none;
display: block;
padding: 7px 12px 7px 20px;
color: #65c0bb;
-webkit-transition: color .3s linear;
-moz-transition: color .3s linear;
-ms-transition: color .3s linear;
-o-transition: color .3s linear;
}
.nav ul li:hover>a, .nav ul li a:hover {
color: #4db6b0;
}
.nav ul li:hover {
background: #f7f7f7;
}
.nav ul ul li:last-child {
border-bottom: 1px solid #ccc;
}
.nav ul ul li {
box-shadow: 3px 3px 0 rgba(0, 0, 0, .1);
}
.nav ul::after, .nav ul::before {
content: "";
display: block;
z-index: 1;
position: absolute;
height: 9px;
width: 9px;
}
.nav>li>ul::after {
border: 1px solid #ccc;
background: #eee;
border-right: 0;
border-bottom: 0;
top: 5px;
left: 25px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-ms-transform: rotate(45deg);
}
.nav>li>ul::before {
height: 1px;
width: 12px;
background: #eee;
border-right: 0;
border-bottom: 0;
top: 10px;
left: 24px;
z-index: 99;
}
.nav ul ul::after {
border: 1px solid #ccc;
background: #eee;
border-right: 0;
border-bottom: 0;
top: 20px;
left: 8px;
position: absolute;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
}
.nav ul ul::before {
height: 10px;
width: 1px;
background: #eee;
z-index: 99;
top: 20px;
left: 12px;
}
.titleImage2 {
margin-left: 250px;
}
.birthdayDream {
padding-right: 15px;
padding-left: 15px;
float: right;
}
p1 {
display: block;
margin-top: 30px;
padding-right: 15px;
padding-left: 15px;
}
form {
margin-left: auto;
margin-right: auto;s
display:inline-block;
width:600px;
}
input {
float:right;
margin-right: 50px;
clear:both;
}
input2 {
float:left;
}
.row {
margin-left: 200px;
}
.batmanImage {
margin-left: 180px;
}
.batmanshop {
height:auto;
margin: 0 auto;
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="style.css">
<title>Birthday Planner - Home</title>
</head>
<body>
<div class="container">
<div class="header">
</div>
<ul class="nav">
<li>
Home
</li>
<li>
Themes
<ul>
<li>Boys Party Theme</li>
<li>Girls Party Theme</li>
</ul>
</li>
<li>About</li>
<li>Contact</li>
<li>Login</li>
<li>Sign Up</li>
</ul>
<div class="content">
<br/>
<IMG class="batmanImage">
<img src="images/batmantitle.jpg" name="Title" width="600" height="206">
</IMG>
<p>All you need to do is select the desired theme and provide us the necessary details. We will do the rest. The items listed below are what will be provided when you order this theme. Don't need to worry about anything else. Just a click of a button and we will get our team to handle the rest for you.
</p>
<img class="batmanshop" src="http://placehold.it/890x2000&text=Batmanshop" name="Title" />
</div>
<div class="footer">
<div class="navigationbar">
<ul class="nav">
<li>
Home
</li>
<li>
About
</li>
<li>
Contact
</li>
<li>
Terms and Conditions
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
Related
Hey I'm having some issues with my mega menu. Im trying to mimic Newegg's style. I want a small sub menu to show up on hover. Here is my codepen: https://codepen.io/iamgonge/pen/vxEEeN
I'm trying to make the sub menu line up with the caret in each menu link. right now it stays in the same spot,When I change it from Absolute it pushes everything down on hover.
/* Body */
body {
margin: 0px;
padding: 0px;
font-family: Helvetica;
background-color: #fff;
}
header {
min-height: 450px;
}
header.dd-blue {
background-color: #fff;
}
/* Nav */
nav {
position: relative;
}
header.dd-blue nav {
background-color: #4F96BA;
}
ul.main-nav {
list-style-type: none;
padding: 0px;
font-size: 0px;
max-width: 1000px;
margin: 0 auto;
}
ul.main-nav h2 {
font-size: .9em;
font-weight: 300;
}
ul.main-nav>li {
display: inline-block;
padding: 0;
}
ul.main-nav>li>a {
display: block;
padding: 20px 30px;
position: relative;
color: #fff;
font-size: 15px;
font-weight: 400;
box-sizing: border-box;
}
ul.main-nav>li:hover {
background-color: #f9f9f9;
}
ul.main-nav>li:hover>a {
color: #333;
font-weight: 400;
}
ul.main-nav>li ul.sub-menu-lists {
margin: 0px;
padding: 1px;
list-style-type: none;
display: block;
}
ul.main-nav>li ul.sub-menu-lists>li {
padding: 0 0px;
margin-top: 2px;
}
ul.main-nav>li ul.sub-menu-lists>li>a {
font-size: .84em;
font-weight: 500;
}
.sub-menu-head {
margin: 10px 0;
border-bottom: 1px solid #4F96BA;
width: 100%;
}
#media only screen and (min-width: 769px) {
/* Desktop */
ul.main-nav {
display: block;
position: relative;
}
.sub-menu-block {
padding: 15px;
}
/* Sub-menu */
ul.main-nav>li>div.sub-menu-block {
visibility: hidden;
background-color: #f9f9f9;
position: absolute;
margin-top: 0px;
width: 100%;
color: #333;
left: 0;
box-sizing: border-box;
z-index: 3;
font-size: 16px;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
opacity: 0;
/*CSS animation applied for sub menu : Slide from Top */
-webkit-transition: all 0.4s ease 0s;
-o-transition: all 0.4s ease 0s;
transition: all 0.4s ease 0s;
-webkit-transform: rotateX(90deg);
-moz-transform: rotateX(90deg);
-ms-transform: rotateX(90deg);
transform: rotateX(90deg);
-webkit-transform-origin: top center;
-ms-transform-origin: top center;
transform-origin: top center;
}
ul.main-nav>li:hover>div.sub-menu-block {
background-color: #fff;
visibility: visible;
opacity: 1;
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
transform: rotateX(0deg);
}
ul.main-nav>li>div.sub-menu-block>* {
-webkit-transition-property: opacity;
-moz-transition-property: opacity;
-o-transition-property: opacity;
transition-property: opacity;
-webkit-transition-duration: 0.4s;
-moz-transition-duration: 0.4s;
-o-transition-duration: 0.4s;
transition-duration: 0.4s;
opacity: 0;
}
ul.main-nav>li:hover>div.sub-menu-block>* {
opacity: 1;
}
.sub-menu-head {
font-size: 20px;
}
header.dd-blue ul.main-nav>li>a {
border-right: 1px solid #666;
}
/* List Separator: Inner Border */
ul.main-nav>li>a:after {
content: '';
width: 1px;
height: 62px;
position: absolute;
right: 0px;
top: 0px;
z-index: 2;
}
header.dd-blue ul.main-nav>li>a:after {
background-color: #999;
}
/* Drop Down/Up Arrow for Mega Menu */
ul.main-nav>li>a.mega-menu>span {
display: block;
vertical-align: middle;
}
ul.main-nav>li>a.mega-menu>span:after {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #fff;
content: '';
background-color: transparent;
display: inline-block;
margin-left: 10px;
vertical-align: middle;
}
ul.main-nav>li:hover>a.mega-menu span:after {
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 0px solid transparent;
border-bottom: 5px solid #666;
}
}
.sub-menu-lists li {
line-height: 1;
}
/* 5 Columns */
.col-xs-15, .col-sm-15, .col-md-15, .col-lg-15 {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
.col-xs-15 {
width: 20%;
float: left;
}
#media (min-width: 768px) {
.col-sm-15 {
width: 20%;
float: left;
}
}
#media (min-width: 992px) {
.col-md-15 {
width: 20%;
float: left;
}
}
#media (min-width: 1200px) {
.col-lg-15 {
width: 20%;
float: left;
}
}
/* end 5 columns */
#rds-font {
font-size: 15px;
}
a, a:active, a:visited, a:link {
color: #599ab9;
text-decoration: none;
}
a:hover {
color: black;
}
#left-border {
border-left: 1px solid #666;
}
/* Hover dropdown */
.dropdown ul.dropdown-menu {
margin-top: 0;
}
.hover_drop_down:hover ul.dropdown-menu {
margin-top: 2px;
}
.hover_drop_down:hover ul.dropdown-menu {
display: inline-block;
position: absolute;
top: 25px;
left: 90%;
z-index: 1;
}
.dropdown-menu>li>a {
display: block;
margin: 10px: padding-bottom: 10px;
font-size: 13px;
font-weight: 500;
line-height: 1;
color: #599ab9;
}
<header class="dd-blue">
<nav role="navigation">
<ul class="main-nav">
<li class="top-level-link">
<a class="mega-menu" id="left-border"><span>Main 1</span></a>
<div class="sub-menu-block">
<div class="row">
<div class="col-xs-15">
<h2 class="sub-menu-head">Header 1</h2>
<ul class="sub-menu-lists">
<li class="hover_drop_down">
Item with sub-menu<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li>Item X</li>
</ul>
</li>
<li class="hover_drop_down">
Item with sub-menu<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li>Item X</li>
</ul>
</li>
</ul>
</div>
</div>
</div> <!--end of sub-menu-block -->
</li>
</ul>
</nav>
</header>
Set position: absolute; display: inline-block; and remove any left and top values so that the element will display where it is in the DOM.
/* Body */
body {
margin: 0px;
padding: 0px;
font-family: Helvetica;
background-color: #fff;
}
header {
min-height: 450px;
}
header.dd-blue {
background-color: #fff;
}
/* Nav */
nav {
position: relative;
}
header.dd-blue nav {
background-color: #4F96BA;
}
ul.main-nav {
list-style-type: none;
padding: 0px;
font-size: 0px;
max-width: 1000px;
margin: 0 auto;
}
ul.main-nav h2 {
font-size: .9em;
font-weight: 300;
}
ul.main-nav>li {
display: inline-block;
padding: 0;
}
ul.main-nav>li>a {
display: block;
padding: 20px 30px;
position: relative;
color: #fff;
font-size: 15px;
font-weight: 400;
box-sizing: border-box;
}
ul.main-nav>li:hover {
background-color: #f9f9f9;
}
ul.main-nav>li:hover>a {
color: #333;
font-weight: 400;
}
ul.main-nav>li ul.sub-menu-lists {
margin: 0px;
padding: 1px;
list-style-type: none;
display: block;
}
ul.main-nav>li ul.sub-menu-lists>li {
padding: 0 0px;
margin-top: 2px;
}
ul.main-nav>li ul.sub-menu-lists>li>a {
font-size: .84em;
font-weight: 500;
}
.sub-menu-head {
margin: 10px 0;
border-bottom: 1px solid #4F96BA;
width: 100%;
}
#media only screen and (min-width: 769px) {
/* Desktop */
ul.main-nav {
display: block;
position: relative;
}
.sub-menu-block {
padding: 15px;
}
/* Sub-menu */
ul.main-nav>li>div.sub-menu-block {
visibility: hidden;
background-color: #f9f9f9;
position: absolute;
margin-top: 0px;
width: 100%;
color: #333;
left: 0;
box-sizing: border-box;
z-index: 3;
font-size: 16px;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
opacity: 0;
/*CSS animation applied for sub menu : Slide from Top */
-webkit-transition: all 0.4s ease 0s;
-o-transition: all 0.4s ease 0s;
transition: all 0.4s ease 0s;
-webkit-transform: rotateX(90deg);
-moz-transform: rotateX(90deg);
-ms-transform: rotateX(90deg);
transform: rotateX(90deg);
-webkit-transform-origin: top center;
-ms-transform-origin: top center;
transform-origin: top center;
}
ul.main-nav>li:hover>div.sub-menu-block {
background-color: #fff;
visibility: visible;
opacity: 1;
-webkit-transform: rotateX(0deg);
-moz-transform: rotateX(0deg);
-ms-transform: rotateX(0deg);
transform: rotateX(0deg);
}
ul.main-nav>li>div.sub-menu-block>* {
-webkit-transition-property: opacity;
-moz-transition-property: opacity;
-o-transition-property: opacity;
transition-property: opacity;
-webkit-transition-duration: 0.4s;
-moz-transition-duration: 0.4s;
-o-transition-duration: 0.4s;
transition-duration: 0.4s;
opacity: 0;
}
ul.main-nav>li:hover>div.sub-menu-block>* {
opacity: 1;
}
.sub-menu-head {
font-size: 20px;
}
header.dd-blue ul.main-nav>li>a {
border-right: 1px solid #666;
}
/* List Separator: Inner Border */
ul.main-nav>li>a:after {
content: '';
width: 1px;
height: 62px;
position: absolute;
right: 0px;
top: 0px;
z-index: 2;
}
header.dd-blue ul.main-nav>li>a:after {
background-color: #999;
}
/* Drop Down/Up Arrow for Mega Menu */
ul.main-nav>li>a.mega-menu>span {
display: block;
vertical-align: middle;
}
ul.main-nav>li>a.mega-menu>span:after {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #fff;
content: '';
background-color: transparent;
display: inline-block;
margin-left: 10px;
vertical-align: middle;
}
ul.main-nav>li:hover>a.mega-menu span:after {
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 0px solid transparent;
border-bottom: 5px solid #666;
}
}
.sub-menu-lists li {
line-height: 1;
}
/* 5 Columns */
.col-xs-15, .col-sm-15, .col-md-15, .col-lg-15 {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
.col-xs-15 {
width: 20%;
float: left;
}
#media (min-width: 768px) {
.col-sm-15 {
width: 20%;
float: left;
}
}
#media (min-width: 992px) {
.col-md-15 {
width: 20%;
float: left;
}
}
#media (min-width: 1200px) {
.col-lg-15 {
width: 20%;
float: left;
}
}
/* end 5 columns */
#rds-font {
font-size: 15px;
}
a, a:active, a:visited, a:link {
color: #599ab9;
text-decoration: none;
}
a:hover {
color: black;
}
#left-border {
border-left: 1px solid #666;
}
/* Hover dropdown */
.dropdown ul.dropdown-menu {
margin-top: 0;
}
.hover_drop_down:hover ul.dropdown-menu {
position: absolute;
display: inline-block;
z-index: 1;
left: auto;
top: auto;
}
.caret-right {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-left: 5px solid;
border-left-color:#1c2b36;
border-bottom: 5px solid transparent;
border-top: 5px solid transparent;
}
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<header class="dd-blue">
<nav role="navigation">
<ul class="main-nav">
<li class="top-level-link">
<a class="mega-menu" id="left-border"><span>Main 1</span></a>
<div class="sub-menu-block">
<div class="row">
<div class="col-xs-15">
<h2 class="sub-menu-head">Header 1</h2>
<ul class="sub-menu-lists">
<li class="hover_drop_down">
Item with sub-menu<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li>Item X</li>
</ul>
</li>
<li class="hover_drop_down">
Item with sub-menu<span class="caret"></span>
<ul class="dropdown-menu" role="menu">
<li>Item X</li>
</ul>
</li>
</ul>
</div>
</div>
</div> <!--end of sub-menu-block -->
</li>
</ul>
</nav>
</header>
I have a menu I am including in every page and I designed it with some style.
Now I saw this gallery, it looks well but it causes my menu some problems,
the style causes this problem is this:
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
I don't understand well what it's doing so I don't know how to fix it.
Anyway, my code is:
Menu:
<%# page language="java" contentType="text/html; charset=windows-1255"
pageEncoding="windows-1255"%>
<%
request.setCharacterEncoding("windows-1255");
response.setCharacterEncoding("windows-1255");
%>
<style>
#import url(http://fonts.googleapis.com/css?family=Montserrat:400,700);
body {
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
}
.headline {
text-align: center;
position: absolute;
margin: auto;
height: 50%;
width: 50%;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
h1 {
font-family: 'Montserrat', sans-serif;
font-weight: 700;
letter-spacing: -5px;
color: #fff;
}
.headline h1 {
border: 3px solid #FFF;
padding: 20px;
font-size: 8vw;
}
#gradient {
width: 100%;
height: 100%;
position: absolute;
background: linear-gradient(270deg, #003366, #b27000, #06617d, #067370);
background-size: 800% 800%;
-webkit-animation: colors 30s ease infinite;
-moz-animation: colors 30s ease infinite;
animation: colors 30s ease infinite;
}
#-webkit-keyframes colors {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
#-moz-keyframes colors {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
#keyframes colors {
0%{background-position:0% 50%}
50%{background-position:100% 50%}
100%{background-position:0% 50%}
}
* {
margin: 0px;
padding: 0px;
}
.wrapper {
margin: 70px auto;
width: 840px;
height: 49px;
border-radius: 5px;
-webkit-box-shadow: 0 0 5px #B9B9B9;
box-shadow: 0 0 5px #B9B9B9;
}
.menu ul {
margin: 0px;
padding: 0px;
list-style-type: none;
}
.menu ul>li {
float: right;
}
.menu ul>li a {
position: relative;
display: inline-block;
min-width: 100px;
padding: 15px 20px;
text-align: center;
text-decoration: none;
background-color: #fff;
color: #6D6565;
font-size: 16px;
-moz-transition: background-color 0.3s, color 0.2s;
-o-transition: background-color 0.3s, color 0.2s;
-webkit-transition: background-color 0.3s, color 0.2s;
transition: background-color 0.3s, color 0.2s;
}
.menu ul>li a:hover {
background-color: #28d;
color: #fff;
}
.menu .parent-item {
position: relative;
}
.menu .parent-item:after {
content: '>';
position: absolute;
top: 13px;
left: -3px;
transform: rotate(90deg) translateY(-50%);
font-size: 19px;
color: #D8D8D8;
}
.menu .parent-item:hover:after {
color: #ff897c;
}
.menu .parent-item:hover .sub-menu {
transform: scale(1, 1) translateX(-50%);
opacity: 1;
}
.menu .parent-item .sub-menu {
position: absolute;
left: 50%;
z-index: 9999;
transform: scale(1, 0) translateX(-50%);
transform-origin: 0 0;
opacity: 0;
width: 190px;
-webkit-box-shadow: 0 0 5px #B9B9B9;
box-shadow: 0 0 5px #B9B9B9;
-moz-transition: all 0.3s;
-o-transition: all 0.3s;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.menu .parent-item .sub-menu a {
display: block;
width: 150px;
background-color: #000;
color: #fff;
}
.menu .parent-item .sub-menu a:hover {
display: block;
width: 150px;
background-color: #F44336;
color: #fff;
}
.menu .parent-item .sub-menu:before {
content: "";
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #000;
width: 0px;
height: 0px;
position: absolute;
top: -6px;
left: 50%;
transform: translateX(-50%);
}
</style>
<div id="gradient">
<div class="headline">
<div class="wrapper">
<nav class="menu">
<ul>
<%
if (session.getAttribute("status") == null || session.getAttribute("status").equals("guest")) {
%>
<li>הרשמה לאתר <span></span></li>
<li>התחברות<span></span></li>
<%
} else {
%>
<li>התנתקות<span></span></li>
<%
}
%>
<li>חדשות<span></span></li>
<li>צור קשר<span></span></li>
<li>דף ראשי<span></span></li>
<li>אודות<span></span></li>
<%
if (session.getAttribute("status") != null && session.getAttribute("status").equals("manager")) {
%>
<li class="parent-item"><a href="#"> <%=session.getAttribute("currentuser")%>
</a>
<ul class="sub-menu">
<li>רשימת לקוחות</li>
<li><a href="../admin/selectWithPictureAndLink.jsp">רשימת
בקשות לשמלות</a></li>
<li><a href="../admin/startheleteWithCheckBoxes.jsp">מחיקת
פעילות מבית ספר</a></li>
<li><a href="../admin/updateSchool.jsp">עדכונים בפעילות של
בית ספר </a></li>
<li><a href="../admin/insertInfotSchool.jsp">הוספה לטבלה
פעילות בית ספר </a></li>
<li>הוספה לקוח</li>
<li><a href="../admin/deleteWithCheckBoxes.jsp">מחיקת
לקוחות</a></li>
<li>איפוס סקר</li>
<li>תוצאות סקר</li>
</ul></li>
<%
}
%>
<%
if (session.getAttribute("status") != null && session.getAttribute("status").equals("member")) {
%>
<li class="parent-item"><a href="#"> <%=session.getAttribute("currentuser")%>
</a>
<ul class="sub-menu">
<li>בקש שמלה אישית</li>
<li>רשימת לקוחות</li>
<li>שינוי סיסמה</li>
<li>שינוי EMAIL</li>
<li>מחיקת משתמש</li>
<li>סקר</li>
</ul></li>
<%
}
%>
</ul>
</nav>
</div>
</div>
</div>
Gallery:
<%# page language="java" contentType="text/html; charset=windows-1255"
pageEncoding="windows-1255"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>שמרו על הכנרת!</title>
<style>
#import
url(http://fonts.googleapis.com/css?family=Titillium+Web:400,600,700,300,200)
;
#import url(http://fonts.googleapis.com/css?family=Croissant+One);
#import url(http://fonts.googleapis.com/css?family=Poiret+One);
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
background: #E4E4E4;
}
body {
padding: 1px;
font-family: 'Titillium Web', sans-serif;
font-size: 16px;
font-weight: 300;
line-height: 22px;
color: #666;
}
h1, h2, h3 {
font-weight: 600;
}
a {
text-decoration: none;
}
/* TITLES
===================================================== */
.pageTitle {
display: block;
margin: 0 0 0.2em 0;
font-size: 2.2em;
line-height: 1em;
color: #3CA0D0;
}
.pageSubtitle {
display: block;
margin: 0 0 0.4em 0;
font-size: 1.4em;
line-height: 1em;
color: #333;
}
/* EFFECTS
===================================================== */
.roundedCorners {
-webkit-border-radius: 5px;
border-radius: 5px;
}
.roundedCornersTop {
-webkit-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.roundedCornersBottom {
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
.boxShadow {
-webkit-box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.25);
box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.25);
}
/* LAYOUT
===================================================== */
.wrapperr {
width: 600px;
margin: 20px 0;
}
.top {
width: 100%;
min-height: 300px;
padding: 20px 0;
text-align: center;
}
.main {
width: 96%;
padding: 2% 2% 5% 2%;
margin: 5% 0;
background: none;
border-bottom: solid 1px #ccc;
}
.footer {
width: 96%;
padding: 2%;
background: #222;
border-top: solid 3px #086FA1;
}
/* GALLERY
===================================================== */
.galleryItem {
display: inline-block;;
position: relative;
width: 250px;
height: 250px;
padding: 0;
margin: 0 20px;
}
.galleryItem img {
width: 100%;
height: 100%;
border: solid 10px #fff;
}
.caption {
position: relative;
overflow: hidden;
display: inline-block;
width: 250px;
height: 250px;
z-index: 10;
}
.caption::before {
content: attr(data-title);
position: absolute;
top: -50%;
left: 0;
width: 100%;
height: 50%;
padding: 10px;
font-family: 'Croissant One', cursive;
font-size: 1.8em;
font-weight: 600;
line-height: 1.4em;
color: #086FA1;
background: #fff;
overflow: hidden;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.caption::after {
content: attr(data-description);
position: absolute;
bottom: -50%;
left: 0;
width: 100%;
height: 50%;
padding: 10px;
font-family: 'Poiret One', cursive;
font-size: .9em;
font-weight: 400;
line-height: 1.4em;
color: #fff;
background: #222;
overflow: hidden;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.caption:hover::before {
top: 0;
}
.caption:hover::after {
bottom: 0;
}
</style>
</head>
<body>
<%
if (application.getAttribute("mone") == null)
application.setAttribute("mone", 0);
if (session.isNew()) {
int m = (Integer) application.getAttribute("mone");
m++;
application.setAttribute("mone", m);
}
%>
<%
request.setCharacterEncoding("windows-1255");
response.setCharacterEncoding("windows-1255");
%>
<jsp:include page="../menu.jsp"></jsp:include>
<div class="wrapperr roundedCorners" align="center">
<div class="main">
<h1 class="pageTitle">Image gallery</h1>
<h2 class="pageSubtitle">With caption fom data tags</h2>
<p>A nice image gallery with animated caption drawn from the
image data tags. Made with CSS3 for modern browsers. Less modern
browsers or non-browser (like Internet Explorer) may encounter
problems with showing the layout correctly.</p>
</div>
</div>
<ul class="top">
<li class="galleryItem"><a class="caption" href="#"
data-title="Colored landscape"
data-description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id sapien condimentum, sagittis erat rhoncus, bibendum nisi.">
<img
src="http://media.digitalcameraworld.com/files/2012/10/Vertorama_landscape_photography_tips_PHO17.insight02and03.vertorama.jpg"
alt="Landscape image">
</a></li>
<li class="galleryItem"><a class="caption" href="#"
data-title="Black & white photo"
data-description="Vivamus ut sem id magna consequat porta vitae ut sem. Proin eget commodo risus, vitae blandit velit. ">
<img
src="http://media.digitalcameraworld.com/files/2012/11/Black_and_white_landscape_photography_DCM131.shoot_creative.main_image_RGB.jpg"
alt="Landscape image">
</a></li>
</ul>
<div align="center">
מונה כניסות:
<%=application.getAttribute("mone")%>
</div>
</body>
</html>
How can I fix the collision? it causes my menu to be smaller and the wrapper be bigger then it needs to be.
box-sizing: border-box; will make width to be content_width + padding.
All you have to do is to fix your widths to include padding in width:
div {
background: url("http://www.justinas.tk/resource/ruler") no-repeat left center;
height: 90px;
}
.a {
width: 200px;
padding: 0 20px;
}
.b {
width: 200px;
padding: 0 20px;
box-sizing: border-box;
}
<div class="a"></div>
<div class="b"></div>
I have a pre-existing responsive menu but I need to add a sub-navigation for each menu choice. How can I do this with CSS?
The important code, I think, is in the section primary navigation.
Thank you in advance for everyone that can help me to understand how sub-menus work.
/**
/* 06. =header styles
/* =================================================================== */
html,
body {
height: 100%;
}
body {
background: #0F1215;
font: 16px/30px "merriweather-regular", serif;
font-weight: normal;
color: #575859;
}
header {
height: 66px;
width: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 600;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-webkit-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
header.opaque {
background: black;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
/* header logo */
header .logo {
background: #fdc501;
float: left;
width: auto;
margin-left: 15px;
margin-right: 30px;
z-index: 600;
/* add position relative since z-index only applies to
elements that have been given an explicit position */
position: relative;
}
header .logo a {
display: block;
margin: 0;
padding: 0;
border: none;
font: 0/0 a;
text-shadow: none;
color: transparent;
width: 114px;
height: 66px;
background: url("../images/logoK#2x.png") no-repeat center;
background-size: 61px 14px;
}
/* header social */
header .header-social {
font-size: 20px;
font-weight: normal;
line-height: 66px;
margin-top: 0;
margin-left: 30px;
padding-left: 36px;
border-left: 1px solid rgba(150, 150, 150, 0.2);
float: left;
position: relative;
top: -1px;
}
header .header-social li {
display: inline-block;
margin-right: 15px;
}
header .header-social li a {
color: #FFFFFF;
}
header .header-social li a:hover {
color: #fdc501;
}
/* media queries:
/* header/header components */
#media only screen and (max-width:880px) {
header .header-social {
display: none;
}
}
#media only screen and (max-width:768px) {
header {
background: black;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
header .row {
width: 100%;
}
header .logo {
margin-left: -30px;
}
}
/* primary navigation
--------------------------------------------------------------------- */
#nav-wrap,
#nav-wrap ul,
#nav-wrap li,
#nav-wrap a {
margin: 0;
padding: 0;
}
/* nav-wrap */
#nav-wrap {
font: 13px "raleway-heavy", sans-serif;
text-transform: uppercase;
letter-spacing: 1.5px;
float: left;
}
/* hide toggle button */
#nav-wrap > a {
display: none;
}
ul#nav {
min-height: 66px;
display: inline-block;
width: auto;
/* left align the menu */
text-align: left;
}
ul#nav li {
position: relative;
list-style: none;
display: inline-block;
height: 66px;
}
/* Links */
ul#nav li a {
/* 14px padding top + 14px padding bottom + 38px line-height = 66px */
display: block;
padding: 14px 12px;
line-height: 38px;
text-decoration: none;
text-align: left;
color: #FFFFFF;
position: relative;
-moz-transition: color 0.2s ease-in-out;
-o-transition: color 0.2s ease-in-out;
-webkit-transition: color 0.2s ease-in-out;
-ms-transition: color 0.2s ease-in-out;
transition: color 0.2s ease-in-out;
}
ul#nav li a:hover {
color: #fdc501;
}
ul#nav li a:active {
background-color: transparent !important;
}
ul#nav li.current a {
color: #fdc501;
}
ul#nav li.current a:after {
position: absolute;
left: 50%;
bottom: 0;
width: 40px;
height: 2px;
margin-left: -23px;
background-color: white;
content: '\0020';
display: block;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
/* mobile navigation
--------------------------------------------------------------------- */
#media only screen and (max-width:768px) {
#nav-wrap {
z-index: 700;
display: block;
width: 100%;
float: none;
position: absolute;
top: 0;
right: 0;
}
/* mobile-btn and toggle-btn */
#nav-wrap > a {
border: none;
color: #FFFFFF;
height: 40px;
min-width: 40px;
font-size: 12px;
text-align: left;
float: right;
display: block;
padding: 0;
position: relative;
top: 13px;
right: 20px;
}
#nav-wrap > a:hover .menu-icon {
background: #FFFFFF;
}
#nav-wrap .menu-icon {
display: inline-block;
width: 24px;
height: 3px;
margin-top: -3px;
position: absolute;
right: 8px;
top: 50%;
bottom: auto;
left: auto;
background: #fdc501;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
font: 0/0 a;
text-shadow: none;
color: transparent;
}
#nav-wrap .menu-icon:before,
#nav-wrap .menu-icon:after {
content: '';
width: 100%;
height: 100%;
position: absolute;
background-color: inherit;
left: 0;
}
#nav-wrap .menu-icon:before {
bottom: 8px;
}
#nav-wrap .menu-icon:after {
top: 8px;
}
/* dropdown nav */
#nav-wrap ul#nav {
background: #1c212a;
padding: 54px 45px 60px 45px;
margin: 0;
height: auto;
display: none;
clear: both;
width: 100%;
float: none;
position: absolute;
top: 66px;
right: 0;
}
#nav-wrap ul#nav > li {
display: block;
float: none;
height: auto;
text-align: left;
border-bottom: 1px dotted rgba(200, 200, 200, 0.1);
padding: 6px 0;
}
#nav-wrap ul#nav > li:first-child {
border-top: 1px dotted rgba(200, 200, 200, 0.1);
}
#nav-wrap ul#nav li a {
display: block;
width: auto;
padding: 0;
color: #cacbcb;
padding: 12px 0;
line-height: 16px;
border: none;
}
#nav-wrap ul#nav li a:hover {
color: #FFFFFF;
}
#nav-wrap ul#nav li.current > a {
background: none;
color: #fdc501;
}
#nav-wrap ul#nav li.current > a:after {
display: none;
}
#nav-wrap a.mobile-btn {
display: none;
}
.js #nav-wrap a#toggle-btn {
display: block;
}
/* if js is disabled */
.no-js #nav-wrap:not(:target) > a:first-of-type,
.no-js #nav-wrap:target > a:last-of-type {
display: block;
}
.no-js #nav-wrap:target ul#nav {
display: block;
}
}
/* make sure the menu is visible on larger screens
--------------------------------------------------------------------- */
#media only screen and (min-width:769px) {
#nav-wrap ul#nav {
display: block !important;
}
}
<header id="main-header">
<div class="row">
<div class="logo">
SAT | Aloia Evelina
</div>
<nav id="nav-wrap">
<a class="mobile-btn" href="#nav-wrap" title="Show navigation">
<span class="menu-icon">Menu</span>
</a>
<a class="mobile-btn" href="#" title="Hide navigation">
<span class="menu-icon">Menu</span>
</a>
<ul id="nav" class="nav">
<li><a class="smoothscroll" href="#hero">Home.</a></li>
<li class="current"><a class="smoothscroll" href="#portfolio">Works.</a></li>
<li><a class="smoothscroll" href="#services">Services.</a></li>
<li><a class="smoothscroll" href="#about">About.</a></li>
<li><a class="smoothscroll" href="#contact">Contact.</a></li>
</ul> <!-- end #nav -->
</nav> <!-- end #nav-wrap -->
<ul class="header-social">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-google-plus"></i></li>
</ul>
</div>
</header> <!-- end header -->
<ul id="nav" class="nav">
<li><a class="smoothscroll" href="#hero">Home.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li>
<li class="current"><a class="smoothscroll" href="#portfolio">Works.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li>
<li><a class="smoothscroll" href="#services">Services.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li>
<li><a class="smoothscroll" href="#about">About.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li>
<li><a class="smoothscroll" href="#contact">Contact.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li> </ul>
in your html file you code should look something like this.
and then for more details on how you can style your code you can visit the site https://css-tricks.com/targetting-menu-elements-submenus-navigation-bar/
It provides some tricks in which you can style your menu as well as I how the html file should look like. I find it very much helpfull.
This is the actual output
How to remove the highlighted section in red, in the actual output?
This is my expected output
JSFiddle Demo link
Example,
.wizard ul
{
list-style: none outside none;
padding: 0;
margin: 0;
width: 4000px;
}
.wizard ul li
{
float: left;
margin: 0;
padding: 0 20px 0 30px;
line-height: 35px;
position: relative;
background: #f5f5f5;
color: #d0d0d0;
font-size: 12px;
cursor: default;
-webkit-transition: all .218s ease;
-moz-transition: all .218s ease;
-o-transition: all .218s ease;
transition: all .218s ease;
}
.wizard ul li .chevron
{
border: 24px solid transparent;
border-left: 14px solid #d4d4d4;
border-right: 0;
border-width: 18px 0 17px 14px;
display: block;
position: absolute;
right: -14px;
top: 0;
z-index: 1;
}
.wizard ul li .chevron:before
{
border: 24px solid transparent;
border-left: 14px solid #f5f5f5;
border-right: 0;
content: "";
display: block;
position: absolute;
right: 1px;
top: -24px;
-webkit-transition: all .218s ease;
-moz-transition: all .218s ease;
-o-transition: all .218s ease;
transition: all .218s ease;
}
.wizard ul li.complete
{
background: #f5f5f5;
color: #444;
}
.wizard ul li.complete:before
{
display: block;
content: "";
position: absolute;
bottom: 0;
left: 0;
right: -1px;
height: 2px;
max-height: 2px;
overflow: hidden;
z-index: 10000;
}
.wizard ul li.complete:hover
{
background: #eee;
cursor: pointer;
}
.wizard ul li.complete:hover .chevron:before
{
border-left: 20px solid #eee;
}
.wizard ul li.complete .chevron:before
{
border-left: 20px solid #f5f5f5;
}
.wizard ul li.active
{
background: #428bca;
color: #262626;
}
.wizard ul li.active:before
{
display: block;
content: "";
position: absolute;
bottom: 0;
left: 0;
right: -1px;
height: 2px;
max-height: 2px;
overflow: hidden;
z-index: 10000;
}
.wizard ul li.active .chevron:before
{
border-left: 14px solid #428bca;
}
.wizard ul li .badge
{
margin-right: 8px;
}
.wizard ul li:first-child
{
-webkit-border-radius: 2px 0 0 0;
-webkit-background-clip: padding-box;
-moz-border-radius: 2px 0 0 0;
-moz-background-clip: padding;
border-radius: 2px 0 0 0;
background-clip: padding-box;
padding-left: 20px;
}
/**/
</style>
<div data-target="#simplewizardinwidget-steps" class="wizard" id="simplewizardinwidget">
<ul class="steps">
<li class="complete" data-target="#simplewizardinwidgetstep1">Personal Information<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep3" class="active">Profile<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification1<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification2<span class="chevron"></span></li>
</ul>
</div>
kindly assist me to achieve this..
Html Part
add overflow: hidden; to .wizard ul
.wizard ul
{ overflow: hidden;
list-style: none outside none;
padding: 0;
margin: 0;
width: 4000px;
}
.wizard ul li
{
float: left;
margin: 0;
padding: 0 20px 0 30px;
line-height: 35px;
position: relative;
background: #f5f5f5;
color: #d0d0d0;
font-size: 12px;
cursor: default;
-webkit-transition: all .218s ease;
-moz-transition: all .218s ease;
-o-transition: all .218s ease;
transition: all .218s ease;
}
.wizard ul li .chevron
{
border: 24px solid transparent;
border-left: 14px solid #d4d4d4;
border-right: 0;
border-width: 18px 0 17px 14px;
display: block;
position: absolute;
right: -14px;
top: 0;
z-index: 1;
}
.wizard ul li .chevron:before
{
border: 24px solid transparent;
border-left: 14px solid #f5f5f5;
border-right: 0;
content: "";
display: block;
position: absolute;
right: 1px;
top: -24px;
-webkit-transition: all .218s ease;
-moz-transition: all .218s ease;
-o-transition: all .218s ease;
transition: all .218s ease;
}
.wizard ul li.complete
{
background: #f5f5f5;
color: #444;
}
.wizard ul li.complete:before
{
display: block;
content: "";
position: absolute;
bottom: 0;
left: 0;
right: -1px;
height: 2px;
max-height: 2px;
overflow: hidden;
z-index: 10000;
}
.wizard ul li.complete:hover
{
background: #eee;
cursor: pointer;
}
.wizard ul li.complete:hover .chevron:before
{
border-left: 20px solid #eee;
}
.wizard ul li.complete .chevron:before
{
border-left: 20px solid #f5f5f5;
}
.wizard ul li.active
{
background: #428bca;
color: #262626;
}
.wizard ul li.active:before
{
display: block;
content: "";
position: absolute;
bottom: 0;
left: 0;
right: -1px;
height: 2px;
max-height: 2px;
overflow: hidden;
z-index: 10000;
}
.wizard ul li.active .chevron:before
{
border-left: 14px solid #428bca;
}
.wizard ul li .badge
{
margin-right: 8px;
}
.wizard ul li:first-child
{
-webkit-border-radius: 2px 0 0 0;
-webkit-background-clip: padding-box;
-moz-border-radius: 2px 0 0 0;
-moz-background-clip: padding;
border-radius: 2px 0 0 0;
background-clip: padding-box;
padding-left: 20px;
}
<br/>
<br/>
<div data-target="#simplewizardinwidget-steps" class="wizard" id="simplewizardinwidget">
<ul class="steps">
<li class="complete" data-target="#simplewizardinwidgetstep1">Personal Information<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep3" class="active">Profile<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification1<span class="chevron"></span></li>
<li data-target="#simplewizardinwidgetstep2" class="complete">Qualification2<span class="chevron"></span></li>
</ul>
</div>
I am attempting to create a CSS3 hover menu that transitions out and shows sub menus below it. The problem I am having is that I can't position the submenus below each other. Currently, I have this effect - http://jsfiddle.net/7pz3g/1/
Here is the HTML markup -
<nav id="navbar">
<ul class="iconContainer">
<li>
<i class="fa fa-home fa-lg"></i>
<ul id="wrapperFirst" class="extMenu">
<li><h3>Testing</h3></li>
<li>SubMenu
<ul id="wrapperSecond" class="subMenu">
<li><h3>ORGANIZATIONS</h3></li>
<li>Reddit</li>
</ul>
</li>
</ul>
</li>
</ul>
</nav>
CSS MarkUp -
li {
list-style: none;
}
#navbar {
background-color: #333333;
position: fixed;
text-align: center;
left: 0;
top: 0;
height: 100%;
z-index: 100;
width: 60px;
display: table;
}
#navbar .iconContainer li {
color: white;
padding: 0 2%;
border-bottom: 1px solid rgba(255, 255, 255, .2);
cursor: pointer;
height: 60px;
}
#navbar .iconContainer li:first-child {
border-top: 1px solid rgba(255, 255, 255, .2);
}
#navbar i {
text-decoration: none;
color: white;
line-height: 60px;
font-size: 1.5em;
text-shadow: 1px 1px 1px #000;
width: 60px;
opacity: .5;
}
#navbar .iconContainer {
padding: 0;
margin: 0;
display: table-cell;
vertical-align: middle;
z-index: 510;
}
#navbar li:hover i {
background-color: #222222;
opacity: 1;
}
#navbar li:hover #wrapperFirst.extMenu {
left: 60px;
}
#wrapperFirst.extMenu {
background-color: #222;
height: 100%;
left: -1000px;
position: fixed;
top: 0;
bottom: 0;
width: 250px;
padding: 0px;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
#wrapperFirst.extMenu .raq {
text-align: right;
float: right;
color: #75A4C7;
}
#wrapperFirst.extMenu li:hover #wrapperSecond.subMenu {
left: 311px;
}
#wrapperFirst.extMenu li {
padding: 10px 20px;
text-align: left;
height: auto;
text-decoration: none;
line-height: 40px;
font-size: 1em;
text-shadow: 1px 1px 1px #000;
color: white;
opacity: 1;
border-bottom: 1px solid rgba(255, 255, 255, .2);
cursor: pointer;
}
#wrapperFirst.extMenu li:first-child {
border-top: 1px solid rgba(255, 255, 255, .2);
}
#wrapperSecond.subMenu {
display:table-cell;
background-color: #222;
height: 100%;
left: -1000px;
position: fixed;
top: 0;
bottom: 0;
width: 600px;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
#wrapperSecond.subMenu h3 {
text-align: center;
}
#wrapperSecond.subMenu .subtitle {
font-family: 'SourceSansProRegular';
font-size: .6em;
}
#wrapperSecond.subMenu li a {
text-decoration: none;
color: #75A4C7;
line-height: 40px;
font-size: 1em;
text-shadow: 1px 1px 1px #000;
}
#wrapperSecond.subMenu li {
padding: 10px 20px;
text-align: left;
height: auto;
text-decoration: none;
line-height: 40px;
font-size: 1em;
text-shadow: 1px 1px 1px #000;
color: white;
opacity: 1;
border-bottom: 1px solid rgba(255, 255, 255, .2);
cursor: pointer;
}
#wrapperSecond.subMenu li {
opacity: 1;
}
#wrapperSecond.subMenu {
width: 600px;
opacity: 1;
}
#wrapperSecond.subMenu h3 {
text-align: center;
}
#wrapperSecond.subMenu .subtitle {
font-family: 'SourceSansProRegular';
font-size: .6em;
}
#wrapperSecond.subMenu li a {
text-decoration: none;
color: #75A4C7;
line-height: 40px;
font-size: 1em;
text-shadow: 1px 1px 1px #000;
}
I would like to have each submenu transition below their root menus, but yet still stay on top of the other elements on the page. Any ideas? Thanks!!!
http://jsfiddle.net/ypzcG/
#wrapperSecond.subMenu li {
opacity: 1;
position: relative;
margin-top: 70px;
}