I seem to be getting an issue with my CSS animation where when I close the Dropdown the background disappears straight away whilst the rest fades away and it makes the dropdown look strange, I have tried everything I can find on CSS animation with no luck so I thought I'd reach out to see if anyone knew.
index.html
<li class="menu-item-3 dropdown">
<a>Info for volunteers</a>
<ul class="child">
<li>
<a href="<?php echo $root; ?>volunteers/your-roles/">
<div class="bold">Your roles</div>
<div class="sub">Your current roles and support</div>
</a>
</li>
<li>
<a href="<?php echo $root; ?>volunteers/news/">
<div class="bold">News</div>
<div class="sub">News for members</div>
</a>
</li>
<li>
<a href="<?php echo $root; ?>volunteers/information/">
<div class="bold">Information</div>
<div class="sub">Useful downloads and pages</div>
</a>
</li>
</ul>
</li>
style.css
.header .nav_container .desktop ul li ul.child {
display: block;
position: absolute;
top: calc( 100% + 30px );
z-index: 900;
background-color: #fff;
right: -10px;
min-width: 200px;
margin: 0;
overflow: hidden;
border: none;
padding: 0 32px;
box-shadow: 2px 2px 0 0 rgba(77, 77, 77, 0.3);
opacity: 0;
visibility: hidden;
animation: fadeout 0.3s;
}
.header .nav_container .desktop ul li ul.child.open {
opacity: 1;
visibility: visible;
animation: fadein 0.3s;
}
#keyframes fadein {
from { opacity: 0;margin-top: 40px; }
to { opacity: 1;margin-top: 0px; }
}
#keyframes fadeout {
from { opacity: 1;margin-top: 0px; }
to { opacity: 0;margin-top: 40px; }
}
Any ideas would be most appreciated. Thanks in advance for taking the time to read this.
Hello the code you posted seems to be incomplete and i would guess you are using some other CSS libraries, nevertheless form what i understand you want to achieve the below.
EDIT:
visibility:hidden attribute should be removed from the .header .nav_container .desktop ul li ul.child selector
.header .nav_container .desktop ul li ul.child {
display: block;
position: absolute;
top: calc( 100% + 30px );
z-index: 900;
background-color: #fff;
right: -10px;
min-width: 200px;
margin: 0;
overflow: hidden;
border: none;
padding: 0 32px;
box-shadow: 2px 2px 0 0 rgba(77, 77, 77, 0.3);
opacity: 0;
animation: fadeout 0.3s;
}
.header .nav_container .desktop ul li ul.child.open {
opacity: 1;
visibility: visible;
animation: fadein 0.3s;
}
#keyframes fadein {
from { opacity: 0;margin-top: 40px; }
to { opacity: 1;margin-top: 0px; }
}
#keyframes fadeout {
from { opacity: 1;margin-top: 0px; }
to { opacity: 0;margin-top: 40px; }
}
Related
The objective here is to display the boxed nav bars vertically when I hover over one of horizontal parent nav bars. When I stop hovering over this bar, that boxed child nav bar should disappear. The detailed HTML and CSS codes are as follows:
a {
background-color: transparent;
}
a {
background-color: transparent;
box-sizing: border-box;
color: #3197d6;
cursor: pointer;
text-decoration: none;
transition: none;
}
a:hover {
text-decoration: underline;
}
a:hover
{
color: #71bff1;
outline-width: 0;
}
a:hover {
opacity: 1;
transform: translate3d(-50%, -80%, 0);
}
.z-nav-list {
margin: 0 auto;
list-style-type: none;
padding: 0;
overflow: hidden;
max-width: 90%;
}
#media (min-width:1600px)
{
.z-nav-list
{
max-width: 1600px;
}
}
#media (min-width:768px)
{
.z-nav-list_item+.z-nav-list_item
{
margin-left: 10px;
}
}
.z-nav-list_item {
float: left;
}
.z-nav-list_link {
display: block;
color: #232320;
font-size: 1.1em;
padding: 1.5em 0.75em;
transition: color .2s linear;
position: relative;
text-decoration: none;
}
#media (min-width:1100px) {
.z-nav-list_link {
padding: 1.5em 2em;
}
}
.z-nav-list_link--project {
padding-left: 0;
}
.z-nav-list_link--project span {
position: relative;
z-index: 10;
}
.z-nav-list_link--project span:before {
z-index: 5;
content: "";
width: 100%;
position: absolute;
bottom: -10px;
height: 3px;
left: 0;
display: block;
background: #ffc4ff;
transform: translate3d(0, 5px, 0);
transition: all .2s cubic-bezier(.175, .885, .32, 1.275);
opacity: 0;
}
.z-nav-list_link--project:hover span:before {
opacity: 1;
transform: translateZ(0) scale3d(1.1, 1.1, 1.1) rotate(-2deg);
}
.z-nav.show-project .z-nav_project,
.z-nav .project-is-visible
{
opacity: 1;
pointer-events: all;
transform: translateZ(0);
}
.z-nav_project
{
pointer-events: none;
opacity: 0; /*0: transparent */
transition: all 0.2s cubic-bezier(.175, .885, .32, 1.275);
transform: translate3d(0, 15px, 0);
position: absolute;
left: 0;
top: 65px;
z-index: 10000; /*this element is always on the top */
display: none; /* remove all the elements */
/* transform: translateZ(0);*/
}
#media (min-width:992px)
{
.z-nav_project
{
display: inline-block;
}
}
.z-nav_project-list
{
list-style-type: none;
margin: 0;
padding: 1.5em 2em 2em;
background: #232320;
box-shadow: 0 4px 4px rgba(0, 0, 0, .06), 0 19px 20px rgba(0, 0, 0, .15);
border-radius: 20px;
min-width: 15em;
}
.z-nav_project-list-item+.z-nav_project-list-item {
margin-top: .5em;
}
.z-nav_project-list-item-link {
padding: .6em 0;
color: #fff;
font-size: 18px;
position: relative;
display: inline-block;
}
.z-nav_project-list-item-link span {
position: relative;
z-index: 10;
}
.z-nav_project-list-item-link:before {
z-index: 5;
content: "";
width: 100%;
position: absolute;
bottom: 3px;
height: 3px;
left: 0;
display: block;
background: #ffc4ff;
transform: rotate(-1deg);
transition: all .2s cubic-bezier(.175, .885, .32, 1.275);
}
.z-nav_project-list-item-link:after {
z-index: 1;
content: "";
height: 100%;
width: 180%;
position: absolute;
left: 0;
display: block;
top: 0;
}
.z-nav_project-list-item-link:hover {
text-decoration: none;
color: #ffc4ff;
}
.z-nav_project-list-item-link:hover:before {
transform: scale3d(1.2, 1.2, 1.2);
}
.z-nav_project-list-item-link:active:before {
transform: scale3d(1.1, 1.1, 1.1);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<header class="z-nav">
<nav class="z-nav">
<ul class="z-nav-list c-nav-list--info">
<li class="z-nav-list_item z-nav-list_item--project">
<a class="z-nav-list_link z-nav-list_link--project" href="#"><span>Project</span></a>
</li>
<li class="z-nav-list_item z-nav-list_item--about">
<a class="z-nav-list_link z-nav-list_link--about" href="/about"><span>About</span></a>
</li>
</ul>
<div class="z-nav_project">
<ul class="z-nav_project-list">
<li class="z-nav_project-list-item">
<span>Project1</span>
</li>
<li class="z-nav_project-list-item">
<span>Project2</span>
</li>
<li class="z-nav_project-list-item">
<span>Project3</span>
</li>
</ul>
</div>
</nav>
</header>
</body>
</html>
If I hover over the horizontal leftmost bar "Project", it should display a vertical nav bar like the following picture. However, my code can not meet this functionality. Can someone help me out? Basically, I want to use CSS opacity property to turn on/off the vertical nav bar. but it does not work. How can I improve this code? Thanks in advance.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I have been trying to make text show on my contact form, but without success. Where am I going wrong?
I tried changing the fonts but that didn't work.
https://jsfiddle.net/1ryby94m/
<!DOCTYPE html>
<html>
<head>
<title> Kontakt </title>
<link rel="stylesheet" href="index.css" type="text/css" />
</head>
<body>
<h1 align="center">
<img src="logo.png" alt="A.Willi A.G" />
</h1>
<div class="menu_div">
<ul>
<li>Home</li>
<li class="dropdown">
Bewerber
<div class="dropdown-content">
Info
Jobs
</div>
</li>
<li class="dropdown">Kunde
<div class="dropdown-content">
Personalverleih
Werkzeuge Mieten
Referenzen
Qulität, Sicherheit und Weiterbildung
</div>
</li>
<li>Kontakt</li>
</ul>
</div>
<div class="fadein">
<img src="welder1.png">
<img src="welder2.png">
<img src="welder3.png">
</div>
<div class="fadein img">
</div>
<form action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi" method="post">
<div>
<label for="name">Name:</label>
<input type="text" id="name" name="user_name">
</div>
<div>
<label for="mail">E-mail:</label>
<input type="email" id="mail" name="user_email">
</div>
<div>
<label for="msg">Message:</label>
<textarea id="msg" name="user_message"></textarea>
</div>
<div class="button">
<button type="submit">Send your message</button>
</div>
</form>
</body>
</html>
body { font-family: verdana; background:white ; color: white; }
.menu_div{background-color: #333; width:100%;}
ul {
list-style-type: none;
margin: 0 auto;
display:table;
padding: 0;
z-index: 100;
overflow: hidden;
}
li {
float: left;
}
li a, .dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn {
background-color: black;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 100;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
#keyframes fade {
0% { opacity: 0; }
11.11% { opacity: 1; }
33.33% { opacity: 1; }
44.44% { opacity: 0; }
100% { opacity: 0; }
}
.fadein { position:absolute; height:102px; width:50px; outline: 1px solid blue; }
.fadein img { position:absolute; left:0; right:0; opacity:0; animation-name: fade; animation-duration: 9s; animation-iteration-count: infinite; }
.fadein img:nth-child(1) { animation-delay: 0s; }
.fadein img:nth-child(2) { animation-delay: 3s; }
.fadein img:nth-child(3) { animation-delay: 6s; }
.menu_div {
position: relative;
z-index: 0;
border: dashed;
height: 2.9em;
margin-bottom: 0em;
margin-top: 0em;
z-index:1000;
}
.fadein {
position: relative;
z-index: 3;
background: ;
width: 100%;
left: 1px;
top: 0em;
}
.fadein img{
margin:0 auto;
width: 100%;
max-width: 4060px;
min-width: 900px;
max-height: 500%;
}
.tech-slideshow {
height: 200px;
max-width: 800px;
margin: 0 auto;
position: relative;
overflow: hidden;
transform: translate3d(0, 0, 0);
}
.tech-slideshow > div {
height: 100px;
width: 2526px;
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/collage.jpg);
position: absolute;
top: 0;
left: 0;
height: 100%;
transform: translate3d(0, 0, 0);
}
.tech-slideshow .mover-1 {
animation: moveSlideshow 12s linear infinite;
}
.tech-slideshow .mover-2 {
opacity: 0;
transition: opacity 0.5s ease-out;
background-position: 0 -200px;
animation: moveSlideshow 15s linear infinite;
}
.tech-slideshow:hover .mover-2 {
opacity: 1;
}
#keyframes moveSlideshow {
100% {
transform: translateX(-66.6666%);
}
}
form {
/* Just to center the form on the page */
margin: 0 auto;
width: 400px;
/* To see the limits of the form */
padding: 1em;
border: 1px solid #CCC;
border-radius: 1em;
}
div + div {
margin-top: 1em;
}
label {
/* To make sure that all label have the same size and are properly align */
display: inline-block;
width: 90px;
text-align: right;
}
input, textarea {
/* To make sure that all text field have the same font settings
By default, textarea are set with a monospace font */
font: 1em verdana;
/* To give the same size to all text field */
width: 300px;
-moz-box-sizing: border-box;
box-sizing: border-box;
/* To harmonize the look & feel of text field border */
border: 1px solid #999;
}
input:focus, textarea:focus {
/* To give a little highligh on active elements */
border-color: #000;
}
textarea {
/* To properly align multiline text field with their label */
vertical-align: top;
/* To give enough room to type some text */
height: 5em;
/* To allow users to resize any textarea vertically
It works only on Chrome, Firefox and Safari */
resize: vertical;
}
.button {
/* To position the buttons to the same position of the text fields */
padding-left: 90px; /* same size as the label elements */
}
button {
/* This extra magin represent the same space as the space between
the labels and their text fields */
margin-left: .5em;
}
You are setting the font color to white in your body CSS.
Either change that, or add:
label {color: black;}
Fiddle: https://jsfiddle.net/t39ey3u3/
This is because the color of your body is white, remove it or add,
body {
color: black;
}
I am having a bit of problem with my website:
body {
margin: 0;
font-family: Tahoma;
background-color: #000000;
background-size: cover;
background-attachment: fixed;
color: #ffffff;
}
#keyframes fadein {
from { opacity: 0; }
to { opacity: 1; }
}
#content {
margin-top: 50px;
animation: fadein 5s;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.00);
position: fixed;
top: 0;
width: 100%;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
a {
transition: all 0.5s;
}
/* Menu Bars */
.section-1 {
position: fixed;
text-align: center;
width: 25%;
top: 20%;
height: 60%;
float: left;
display: block;
z-index: 1;
background-color: #000000;
}
.section-1:hover + .menu-1 {
opacity: 1;
transition: opacity 0.5s ease-in-out;
}
.menu-1 {
position: fixed;
text-align: center;
width: 25%;
top: 20%;
height: 60%;
float: left;
z-index: 2;
background-color: rgba(255, 0, 0, 0.50);
display: block;
opacity: 0;
transition: opacity 0.5s ease-in-out;
pointer-events: none;
}
<body>
<div id="navigation-menu">
<ul>
<li>Title</li>
</ul>
</div>
<div id="content">
<div class="section-1">
<p>Menu 1</p>
</div>
<div class="menu-1">
<br />
<br />
<br />
<br />
<br />
<br />
Link 1
</div>
</div>
</body>
As you can see, the expected behavior is that when I hover the div with the "Menu 1" text, the div with the "Link 1" link appears and that the "Link 1" link is clickable which will direct the user to another page. However, the "Link 1" hyperlink is unclickable and instead, highlights the "Menu 1" text.
How do I make it so that the "Like 1" hyperlink can be clicked?
You have pointer-events:none on .menu-1. If you absolutely need to keep this property, add pointer-events:auto to the a tag. However, I would suggest restructuring your code so that the menu can transition without the overlay.
I am using transform scale on an image to zoom it on hover. However, when the zooming animation completes, the image jerks a bit. This is only happening in Firefox (I am using the latest version 39.0 but this issue was present in earlier versions as well). I don't see this problem in Chrome.
Here is the JSFiddle.
Code is as follows:
HTML
<div class="item-box">
<div class="category-item">
<div class="picture">
<a title="Show products in category Hats" href="/digital-downloads">
<img title="Show products in category Hats" src="http://s6.postimg.org/gyzzlqts1/hats1_350.jpg" alt="Picture for category Hats">
<div class="inset-shadow"></div>
</a>
</div>
<h2 class="title">
<a title="Show products in category Hats" href="/digital-downloads">
Hats
</a>
</h2>
</div>
</div>
CSS
.item-box:nth-child(2n+1) {
clear: none;
}
*, *::before, *::after {
box-sizing: border-box;
}
.item-box {
width: 313px;
height: 313px
}
.item-box {
margin: 0 0 80px;
}
.item-box {
float: left;
margin: 0 0 40px;
padding: 0 5px;
position: relative;
text-align: left;
}
.item-box .picture {
background-color: rgb(255, 255, 255);
margin: 0 0 20px;
overflow: hidden;
z-index: 1;
margin:0;
}
.item-box .picture a {
display: block;
position: relative;
background-color: rgb(255, 255, 255);
transition: all 0.4s linear 0s;
z-index: 10;
}
.item-box .picture a img {
margin: auto;
max-height: 100%;
max-width: 100%;
transition: all 0.6s linear 0s;
}
.item-box:hover .picture a img {
transform: scale(1.09);
}
a img {
opacity: 0.99;
}
a img {
border: medium none;
}
.inset-shadow {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
transition: all 0.4s ease 0s;
}
.inset-shadow:hover {
box-shadow: 0 0 0 30px rgba(97, 91, 89, 0.35) inset;
}
Thanks.
I'm looking for a CSS only solution to fade an image in a back DIV when hovering over any section of the DIV, including DIVs that are in front of it.
Here is what I've been able to build so far: http://jsfiddle.net/kqo10jLb/
The CSS:
#caseouter {
position: relative;
top: 0px;
}
#casewrap2 {
background-color: #000;
}
#casetitle {
font-size: 30px;
width: 100%;
display: block;
text-transform: uppercase;
text-align: center;
padding: 10px 0px 0px 0px;
color: #fff;
margin-bottom: 0px;
}
#casethumb {
width: 100%;
display: block;
margin-bottom: -100px;
opacity: 1;
transition: .2s opacity ease .2s;
height: 100px;
}
#casesecondline {
font-size: 30px;
color: #666;
text-transform: uppercase;
margin: 0 auto;
display: block;
width: 100%;
text-align: center;
color: #fff;
margin-top: -10px;
padding: 0px;
}
#casethumb img {
width: 100%;
}
#casethumb:hover {
opacity: .75;
}
#casetitle:hover ~ #casethumb a {
opacity: .75;
}
#casesecond:hover ~ #casethumb a {
opacity: .75;
}
And the HTML:
<div id="casewrap2">
<div id="casethumb">
<a href="www.google.com">
<img src="http://ringer.tv/wp-content/uploads/2014/08/case_bravo.jpg">
</a>
</div>
</div>
<div id="caseouter">
<a href="www.google.com">
<div id="casetitle">Headline</div>
<div id="casesecondline">Subheadline</div>
</a>
</div>
As you'll see, the back image fades on hover, however, it will not fade when I hover over the headline and subheadline text. I've tried using #casetitle:hover ~ #casethumb a but I'm obviously doing something wrong. Thanks!
Is this what you're after? http://jsfiddle.net/kqo10jLb/1/
I moved the caseouter into the casewrap2 object and changed the hover to this:
#casewrap2:hover #casethumb {
opacity: .75;
}