How to get underline animation to only take up width of link? - html

Right now on hover the underline animation I've set up for my .nav extends past the link, and I want to make it so it only takes up the width of the link. The width is set to 100%, so I'm not quite sure why it's doing that. Also tried messing around with padding to see if that was the issue but didn't work. Could it be because of bootstrap?
html, body {
font-family:;
margin:0 auto;
text-transform: lowercase;
font-family: Roboto;
letter-spacing: 0.5px;
}
.nav {
float: right;
display: inline-block;
margin:0 auto;
list-style: none;
}
.nav li {
display: inline-block;
margin:0 auto;
list-style: none;
list-style: none;
display: inline;
padding-top:0;
padding-left: 10px;
}
.nav > li > a {
padding: 10px;
color: white;
font-family: Roboto;
text-decoration: none;
position: relative;
width:100%;
}
.nav > li > a:hover {
background-color:transparent;
text-decoration: none;
}
.nav > li > a:focus {
background-color:transparent;
text-decoration: none;
}
.nav > li > a:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
background-color:white;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
.nav > li > a:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
width:100%;
}
.work h1 {
border-left: 0px solid black;
padding-top:30px;
display:inline-block;
left:50%;
position: absolute;
transform: translate(-50%, -50%);
color:;
}
.work a {
color: black;
text-decoration: none;
}
.supporting .container-fluid {
background-image: url("img/photo-top.jpg");
height: 600px;
background-size: cover;
background-position: center center;
text-align: center;
position:relative;
top: 0;
width: ;
height: 100vh;
}
.work .container-fluid {
height:500px;
margin: 0 auto;
background: white);
width:100%;
padding:0;
}
.photography .container-fluid {
height:500px;
margin: 0 auto;
background: white);
width:100%;
padding:0;
}
.photography a {
border-left: 0px solid black;
padding:10px;
display:inline-block;
left:50%;
position: absolute;
transform: translate(-50%, -50%);
color:black;
}
div.container-fluid {
padding:0;
width:100%;
height: 100%;
}
.info {
position: absolute;
top: 50%;
left: calc(50% - 180px);
width: 360px;
}
.info h1 {
margin:0 auto;
color:white;
font-size: 50px;
}
.info a {
color: white;
}
.info a:hover {
color: white;
background-color:transparent;
text-decoration: none;
}
}

Related

How can i change mobile menu one scroll to multiple pages?

I have one page scroll menu,but i've changed that in multiple page.These kind of menu is working on desktop,but is not working on mobile version.How can I change code css or html because in mobile version when i click on menu and close it anywhere i clicked redirectg me to another page.
.mobile-menu {
display: block;
width: 18%;
right: -20%;
height: 100%;
background: rgba(1, 16, 25, 0.67);
position: fixed;
z-index: 9998;
transition: 0.6s ease;
top: 0;
opacity: 0;
}
.mobile-menu ul {
position: relative;
top: 20%;
padding: 0;
}
.mobile-menu ul li {
list-style: none;
margin-bottom: 2em;
display: block;
}
.mobile-menu ul li a {
width: 100%;
margin: 0 auto;
display: block;
text-align: center;
text-decoration: none;
color: #fff;
font-size: 1em;
font-weight: bold;
overflow: hidden;
position: relative;
padding: 1em 0;
text-transform: uppercase;
letter-spacing: 3px;
}
.open > ul.dropdown-menu.agile_short_dropdown{
display: block;
transform: none !important;
min-width: 65%;
border: none;
box-shadow: none;
border-radius: 0;
left: 18%;
}
.open > ul.dropdown-menu.agile_short_dropdown li{
margin:0 !important;
}
ul.dropdown-menu.agile_short_dropdown > li > a:hover{
background: none;
}
.mobile-menu ul li a:after {
content: '';
background: #191143;
width: 100%;
height: 100%;
position: absolute;
right: -100%;
top: 0;
z-index: -1;
transition: 0.4s ease;
}
.mobile-menu ul li a:hover,.mobile-menu ul li.active a {
color: #fff;
}
.mobile-menu ul li a:hover:after,.mobile-menu ul li.active a:after {
right: 0;
}
li.dropdown.act a.w3_icons_act {
background: #0e0e0e;
color: #fff;
}
.mobile-menu img {
position: absolute;
width: 150px;
display: block;
left: 50%;
top: 3rem;
transform: translatex(-50%);
-webkit-transform: translatex(-50%);
-moz-transform: translatex(-50%);
-o-transform: translatex(-50%);
-ms-transform: translatex(-50%);
padding: 0;
text-align: center;
}
.mobile-menu--open {
opacity: 1;
right:0%;
}
.dropdown.active.open a ul.dropdown-menu.agile_short_dropdown li a.w3_icon_1:after{
background:none !important;
<div class="center-container">
<div class="w3_agile_header">
<div class="w3_menu">
<div class="agileits_w3layouts_banner_info">
</div>
<div class="mobile-nav-button">
<div class="mobile-nav-button__line"></div>
<div class="mobile-nav-button__line"></div>
<div class="mobile-nav-button__line"></div>
</div>
<nav class="mobile-menu">
<ul>
<li><a href="https://ioanasandu.ro/online/web/index.html" class="hover" >Despre mine</a></li>
<li>Repertoriu</li>
<li>Discografie</li>
<li>Evenimente</li>
<li>Foto</li>
<li>Video</li>
<li>Contact</li>
</ul>
</nav>
</div>
<div class="clearfix"></div>
</div>
Can anyone help me?

More than one sliding menu in a page

I've managed to make a sliding menu link, but when I try to make another it doesn't work like the first one.
Here's a wireframe of what I'm trying to achieve:
/*HOME MENU*/
#home {
position: fixed;
left: -8.5em;
top: 20px;
width: 8em;
background: black;
color: white;
margin: -1em 0 0 0;
padding: 0.5em 0.5em 0.5em 2.5em;
transition: 0.2s
}
#home:hover {
left: 0
}
#home a {
position: relative;
left: 0;
transition: 0.2s
}
#home a:link {
color: white;
text-decoration: none;
}
#home a:visited {
color: green;
}
#home a:hover {
color: gray;
}
#home a:active {
left: -7em;
background: hsla(80, 90%, 40%, 0.7);
color: white;
}
#home a:focus {
left: -7em;
background: hsla(80, 90%, 40%, 0.7);
}
/*3D MENU*/
#3D {
position: fixed;
left: -8.5em;
top: 20px;
width: 8em;
background: black;
color: white;
margin: -4em 0 0 0;
padding: 0.5em 0.5em 0.5em 2.5em;
transition: 0.2s
}
#3D:hover {
left: 0
}
#3D a {
position: relative;
left: 0;
transition: 0.2s
}
#3D a:link {
color: white;
text-decoration: none;
}
#3D a:visited {
color: green;
}
#3D a:hover {
color: gray;
}
#3D a:active {
left: -7em;
background: black;
color: white;
}
#3D a:focus {
left: -7em;
background: black;
}
<ul id="home">
PERFIL<img src="menu/home.png" style="max-width:32px; height:auto;" align="right">
</ul>
<ul id="3D">
GRAFICA 3D<img src="menu/3d.jpg" style="max-width:32px;height:auto;" align="right">
</ul>
(fiddle)
So, your semantic seems a little bit confusing. You should avoid inline-scripts and 'ul' tags without 'li' inside.
Your css strategy is nice, but you are repeating information, wich is bad for maintenance. I wrote your code into a better semantic and CSS.
To achieve your slider, i'm using CSS transform property.
.wrapper * {
overflow:hidden;
list-style:none;
margin:0;
padding:0;
}
.wrapper ul li {
display:flex;
margin-bottom:4px;
}
.wrapper ul li a {
background:black;
color:white;
padding:5px 10px;
transform: translateX(calc(-100% + 32px));
transition: transform 0.2s ease;
}
.wrapper img {
max-width:32px;
margin-left:5px;
}
.wrapper ul li a:hover {
background:black;
color:white;
padding:5px 10px;
transform: translateX(0);
}
<div class="wrapper">
<ul id="home">
<li id="item1">
TEST1<img src="menu/home1.png">
</li>
<li id="item2">
TEST2<img src="menu/home2.png">
</li>
</ul>
</div>

NAV menu doesn't appear on top

How do i make my nav menu permanently on top? I have two nav menu's on a page - a main hamburger nav menu that clicks and pops up, and then an embedded page nav menu
I would like the hamburger nav menu to be permanently on top, but for some reason the embedded nav menu appears through.
Here is a codepen of the issue: https://codepen.io/TheGreatEscape/pen/ebYgGO
Here is a short youtube video if the issue: https://youtu.be/sWzCLOzRJUQ
and the related CSS Code:
/*===== NAV BUTTONS ===*/
#menu-button{ display:none}
a {
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
}
a:hover, a:active, a:focus {
outline: none;
float:none;
clear:both;
text-align:center;
display:inline-block;
position:absolute;
left:0;
right:0 }
.templateux-navbar {
position: fixed;
top: 0px;
left: 0;
width: 100%;
padding: 0;
z-index: 99999;
}
.templateux-navbar .container-fluid {
max-width: 100%;
}
.templateux-navbar .toggle-menu {
z-index: 9999;
}
.templateux-navbar .templateux-menu {
top:35px;
float:none;
clear:both;
text-align:center;
display:inline-block;
position:absolute;
right:210px
}
.templateux-navbar .templateux-menu ul {
position:relative;
float:right;
margin-bottom: 0;
margin-top: 18.5px;
right:178px;
}
.templateux-navbar .templateux-menu ul li {
display: block;
}
.templateux-navbar .templateux-menu ul li a {
left:30px;
top:.5px;
text-decoration: none;
border-radius:0; border:none;
line-height:40px;
display:block;
margin-right: 0px;
font-size: 13px;
text-transform: uppercase;
letter-spacing: .05em;
color: #1a1a1a;
position: relative;
padding-bottom: 5px;
}
.templateux-navbar .templateux-menu ul li a:before {
content: "";
position: absolute;
bottom: 6px;
height: 3px;
width: 0;
left: 0px;
background: #f70f4d;
-webkit-transition: .45s width ease;
-o-transition: .45s width ease;
transition: .45s width ease;
}
.templateux-navbar .templateux-menu ul li a:hover:before {
width: 100%;
}
.templateux-navbar .templateux-menu ul li a:hover {
text-decoration: none;
background-color: inherit;
border:none;
color:#1a1a1a;
font-weight:bold
}
.templateux-navbar .templateux-menu ul li h5 {
position: absolute;
text-decoration: none;
background-color: inherit;
left: 125px;
top: -8px;
color:#1a1a1a;
font-weight:bold;
font-size: 13px;
border-radius:0;
border:none;
line-height:40px;
display: inline-block;
width: 100%;
letter-spacing: .1em;
}
.templateux-navbar .templateux-menu ul li.active > a:before {
width: 100%;
}
.templateux-navbar .templateux-menu ul li:last-child a {
margin-right: 0;
}
/*===== BACKGROUND MENU FOR MENU BUTTON, GET IN TOUCH ===*/
.menu {
width: 33px;
height: 33px;
padding: 5px;
display: block;
cursor: pointer;
position: relative;
float: right;
right: -56px;
top: 24px;
z-index: 1;
}
.menu span {
cursor: pointer;
height: 3.25px;
width: 24px;
margin-bottom: 3px;
background: #000;
position: relative;
right: 0;
display: block;
transform: rotate(0deg);
transition: .7s ease;
}
.hidden {
opacity: 0;
transition-delay: .5s;
pointer-events: none;
cursor: default;
}
.visible {
opacity: .97;
}
.menu.open span:nth-child(1) {
top: 10px;
transform: rotate(180deg);
transition: .7s ease;
background: #ffffff;
}
.menu.open span:nth-child(2) {
opacity: 0;
right: 100px;
background: #000;
}
.menu.open span:nth-child(3) {
top: 0px;
transform: rotate(-180deg);
transition: .8s ease;
background: #ffffff;
}
#navigation {
background: #000000;
font-family: 'Titling Gothic Bold';
color: rgb(0, 0, 0);
font-size: 0px;
width: 100%;
height: 450px;
text-align:left;
}
Your issue is the z-index. I fixed it by adding the class hamburger to your first .templateux-navbar element and then modified your CSS a bit. You can see the modified CSS below.
.templateux-navbar {
position: fixed;
top: 0px;
left: 0;
width: 100%;
padding: 0;
z-index: 9;
}
.templateux-navbar.hamburger {
z-index: 10;
}
Your code has this issue because you gave both the menus the same z-index so it means that the element that is defined next in the HTML will naturally get higher priority, which in your case is your second nav.
Making your hamburger menu have a higher z-index solves this issue.

how to get responsive hamburger menu to not push down content

I have this responsive hamburger nav that is currently pushing down the content below it. Is there a way to get it to just hover over the content instead? I have tried so many things, nothing that I am doing works but I'm not an expert. Any help is much appreciated! Thanks!
jsfiddle here
<nav class="header">
<input class="menu-btn" type="checkbox" id="menu-btn" />
<label class="menu-icon" for="menu-btn"><span class="navicon"></span></label>
<ul class="menu">
<li>Our Work</li>
<li>About</li>
<li>Careers</li>
<li>Contact</li>
</ul>
</nav>
<figure id="main-img"></figure>
figure#main-img {
width: 100%;
position: relative;
overflow: hidden;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
z-index: 10;
height: 200px;
background-color: red;
}
nav.header {
background-color: silver;
width: 100%;
float: left;
overflow: hidden;
}
.table {
display: table;
margin: 0 auto;
}
.header ul {
list-style: none;
position: relative;
float: left;
display: block;
left: 50%;
max-width: 1200px;
margin: 0;
padding: 0;
}
.header ul li {
position: relative;
right: 50%;
/*float: left;
display: inline-block;*/
}
.header li a {
display: block;
padding: 1em;
text-decoration: none;
color: #000000;
}
.header li a:hover {
background-color: #B5B5B5;
}
.header .menu {
clear: both;
max-height: 0;
transition: max-height .2s ease-out;
}
.header .menu-icon {
cursor: pointer;
display: inline-block;
float: right;
padding: 28px 20px;
position: relative;
user-select: none;
}
.header .menu-icon .navicon {
background: #333;
display: block;
height: 2px;
position: relative;
transition: background .2s ease-out;
width: 18px;
}
.header .menu-icon .navicon:before, .header .menu-icon .navicon:after {
background: #333;
content: '';
display: block;
height: 100%;
position: absolute;
transition: all .2s ease-out;
width: 100%;
}
.header .menu-icon .navicon:before {
top: 5px;
}
.header .menu-icon .navicon:after {
top: -5px;
}
.header .menu-btn {
display: none;
}
.header .menu-btn:checked ~ .menu {
max-height: 240px;
}
.header .menu-btn:checked ~ .menu-icon .navicon {
background: transparent;
}
.header .menu-btn:checked ~ .menu-icon .navicon:before {
transform: rotate(-45deg);
}
.header .menu-btn:checked ~ .menu-icon .navicon:after {
transform: rotate(45deg);
}
.header .menu-btn:checked ~ .menu-icon:not(.steps) .navicon:before, .header .menu-btn:checked ~ .menu-icon:not(.steps) .navicon:after {
top: 0;
}
#media only screen and (min-width: 750px) {
.header li {
float: left;
}
.header li a {
padding: 20px 30px;
}
.header .menu {
clear: none;
/*float: right;*/
max-height: none;
}
.header .menu-icon {
display: none;
}
}
#media only screen and (max-width: 750px) {
.header li a {
background-color: Silver;
opacity: 0.9;
}
.header ul li {
border-bottom: 1px solid #000000;
color: #000;
}
.header ul li:first-child {
border-top: 0px solid #000000;
}
.header ul {
width: 100%;
}
}
#media only screen and (max-width: 480px) {
nav.header {
}
}
Code (only the relevant css, the html did not change) from the JSFiddle in case it stops working:
body {
width:100%;
margin:0;
}
figure#main-img {
width: 100%;
position: relative;
float:left;
overflow: hidden;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
height: 300px;
background-color: red;
margin:58px 0 0 0;
}
nav.header {
background-color: silver;
opacity: 0.75;
position: absolute;
width: 100%;
top:0;
z-index:10;
float: left;
margin:0;
overflow:hidden;
}
.header .menu-icon {
padding: 28px 20px;
}
here is a JSFiddle you can work with.
nav.header {
background-color: silver;
position: absolute;
width: 100%;
top:0;
z-index:10;
float: left;
margin:0;
overflow:hidden;
}
Here you can see that I set the position to be absolute, set it to the top and then z-index is a larger number than the default.
Hope it helped, Andrew

Glitches on webkit-animation on Chrome

I have a HTML/CSS menu that opens either left or right on the CSS:hover effect. It seems to be working well on most modern browsers, but on Chrome the text glitches a bit, when the effect goes to the left.
fiddle
HTML:
<ul class="tabs">
<li class="rotateL work_link">WORK
<ul class="submenu">
<li>housing</li>
<li>interior</li>
<li>public space</li>
<li>public buildings</li>
<li>planing</li>
<li>design</li>
<li>search</li>
</ul>
</li>
<li class="rotateR practise_link">PRACTICE
<ul class="submenu">
<li>mission</li>
<li>history</li>
<li>services</li>
<li>awards</li>
</ul>
</li>
</ul>
CSS:
ul.tabs, ul.tabs ul {
margin:0 auto;
padding:0;
list-style:none;
font-size: 7pt;
}
ul.tabs > li {
border: 1px solid #fff;
position:relative;
}
ul.tabs > li > a {
float:left;
width:18px;
}
ul.tabs li:hover > a {font-weight: bold; }
ul.tabs li ul {
position:absolute;
left:0;
opacity:0;
height:0;
width:0;
overflow:hidden;
background: #fff;
vertical-align: bottom;
/*display: table;*/
}
ul.tabs li li { line-height: 12pt; white-space: nowrap;}
ul.tabs ul a {
line-height: 12pt;
background:#fff;
margin-bottom:-1px;
text-decoration:none;
color:#000;
text-transform: uppercase;
display: block;
padding: 0px 2px;
}
ul.tabs:hover li ul {
display: block;
opacity: 1;
cursor: pointer;
white-space: nowrap;
overflow: hidden;
}
ul.tabs li.rotateL, ul.tabs li.rotateR { background: #fff; width: 18px;}
ul.tabs li.rotateL > a,ul.tabs li.rotateR > a {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
display: block;
bottom: 10px;
position: absolute;
color: #000;
font-weight: normal;
text-decoration: none;
white-space: nowrap;
}
ul.tabs li.rotateL > a:hover, ul.tabs li.rotateR > a:hover { font-weight: normal; }
ul.tabs li.rotateR ul {
left: -127px;
top: -1px;
text-align: right;
border-right: 1px solid #111;
}
ul.tabs li.rotateL ul {
left:19px;
top: -1px;
white-space:normal;
border-left: 1px solid #111;
}
li.work_link {
left: 40px;
height: 151px;
display: block;
color: #000;
cursor: pointer;
}
ul.tabs li.work_link ul {
height: 108px;
width: 110px;
vertical-align: bottom;
padding-top: 45px;
}
ul.tabs:hover li.work_link ul:not(.active) {
animation:workLink 2s 1;
-webkit-animation:workLink 2s 1; /*Safari and Chrome*/
}
#keyframes workLink
{
from {width: 0px; }
to {width: 110px; }
}
#-webkit-keyframes workLink /*Safari and Chrome*/
{
from {width: 0px; }
to {width: 110px; }
}
li.practise_link {
left: 165px;
height: 98px;
display: block;
cursor: pointer;
}
ul.tabs li.practise_link ul {
height: 64px;
padding-top: 36px;
width: 58px;
left: -58px
}
ul.tabs:hover li.practise_link ul:not(.active) {
animation:practiseLink 2s 1;
-webkit-animation:practiseLink 2s 1; /*Safari and Chrome*/
}
#keyframes practiseLink
{
from {width: 0px; left: -2px}
to {width: 58px; left: -58px}
}
#-webkit-keyframes practiseLink /*Safari and Chrome*/
{
from {width: 0px; left: -2px; }
to {width: 58px; left: -58px; }
}
If the code is too messy, just let me know, and I guess I should work on another easier solution :/
Thanks in advance.
Here's a real answer so you can mark it as correct answer. Sorry for the duplicate.
I have no solution out of the box right now, but I can tell you that
it's caused by the right-aligned text. It "shakes" when the browser
recalculate the text position while animating. You should try to set
the element width (mixed with overflow:hidden) to avoid this
recalculation.