could you please help me to solve my problem? Since I am trying to add URL into my image it does not do anything. I have a CSS animation inside of my image. The system is based on wordpress. After the image hover, image is not clickable after the url is set.
The html code looks like this
<div class="hover ehover1">
<img class="img-responsive" src="imageSOURCEurl" alt="" />
<div class="overlay"></div>
</div>
When I try to add url it looks like this
<div class="hover ehover1">
<a href="URL HERE DOES NOT WORK"><img class="img
responsive" src="imageSOURCEurl"
alt="" /></a>
<div class="overlay"></div>
</div>
CSS
#lab_snippet_module .col-lg-3,
#lab_snippet_module .col-md-4,
#lab_snippet_module .col-sm-6,
#lab_snippet_module .col-xs-12 {
padding: 0!important;
}
#lab_snippet_module {
background: purple;
padding: 50px 0;
}
.hover,
.hover h2 {
text-align: center
}
.hover,
.hover .overlay {
width: 100%;
height: 100%;
overflow: hidden
}
.ehover11 .overlay::before,
.ehover12 h2::after,
.ehover7 .overlay::before {
content: ''
}
.hover button.info,
.hover h2 {
text-transform: uppercase;
color: #fff
}
.navbar-inverse {
color: #fff;
background-color: rgba(255, 255, 255, .2);
border-bottom: 1px solid #fff
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav>li>a {
color: #fff
}
.col-lg-3,
.col-md-4,
.col-sm-6,
.col-xs-12 {
padding: 0
}
.hover {
float: left;
position: relative;
cursor: default
}
.hover .overlay {
position: absolute;
top: 0;
left: 0
}
.hover img {
display: block;
position: relative
}
.ehover10 button,
.hover button.info {
display: inline-block
}
.hover h2 {
position: relative;
font-size: 17px;
padding: 10px;
background: rgba(0, 0, 0, .6)
}
.hover button.info {
text-decoration: none;
padding: 7px 14px;
border: 1px solid #fff;
margin: 50px 0 0;
border-radius: 0;
background-color: transparent
}
.hover button.info:hover {
box-shadow: 0 0 5px #fff
}
.ehover5 button.info:hover,
.hover button.nullbutton:hover {
box-shadow: none
}
.hover button.nullbutton {
border: none;
padding: 0;
margin: 0
}
.ehover4 button.info,
.ehover42 button.info {
margin: -55px 0 0;
padding: 73px 90px;
font-weight: 400;
border: 1px solid #fff
}
.modal-open .modal,
button:focus {
outline: 0!important
}
.point {
cursor: pointer
}
.ehover1 img {
-webkit-transition: all .4s linear;
transition: all .4s linear
}
.ehover1 .overlay {
opacity: 0;
background-color: rgba(0, 0, 0, .5);
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out
}
.ehover1 h2 {
-ms-transform: translatey(-100px);
-webkit-transform: translatey(-100px);
transform: translatey(-100px);
opacity: 0;
-webkit-transition: all .2s ease-in-out;
transition: all .2s ease-in-out
}
.ehover1 button.info {
opacity: 0;
-webkit-transition: all .2s ease-in-out;
transition: all .2s ease-in-out
}
.ehover1:hover img {
-ms-transform: scale(1.2);
-webkit-transform: scale(1.2);
transform: scale(1.2)
}
.ehover1:hover .overlay {
opacity: 1
}
.ehover1:hover button.info,
.ehover1:hover h2 {
opacity: 1;
-ms-transform: translatey(0);
-webkit-transform: translatey(0);
transform: translatey(0)
}
.ehover1:hover button.info {
-webkit-transition-delay: .2s;
transition-delay: .2s
}
Thank you
It is because .hover .overlay {}
has a position absolute. This makes that it will "hide" your ahref functionality.
Make sure your is above the overlay to make it clickable.
For example: If I just remove the position:absolute from .hover .overlay {}, then it works. Check this plunkr as an example: https://plnkr.co/edit/6MuuVZH2LlbxTcCHblxa?p=preview
Related
I’m trying to make a menu open button for my website, but there’s one slight problem, when I try to assign it to move vertically, for example do margin-top: 100px it won’t move. But when I set a margin-left it changes position and moves horizontally! I have no idea as to why this is happening. I would love to get some advice on how to put the menu button a bit further downwards. I have a feeling it has something to do with the attribute being a span, but I have no idea. Any help is greatly appreciated.
function openNav() {
document.getElementById("myNav").style.width = "100%";
}
function closeNav() {
document.getElementById("myNav").style.width = "0%";
}
#import url("https://fonts.googleapis.com/css2?family=Montserrat:wght#400;500;600;700&display=swap");
* {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: "Montserrat", sans-serif;
background-size: cover;
}
#myVideo {
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
}
.navMenu {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.overlay a {
padding: 8px;
text-decoration: none;
font-size: 36px;
color: #818181;
display: block;
transition: 0.3s;
}
.navMenu a {
color: #f6f4e6;
text-decoration: none;
font-size: 1.2em;
text-transform: uppercase;
font-weight: 500;
font-size: 40px;
display: inline-block;
width: 160px;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
padding: 0px;
padding-bottom: 5px;
}
.navMenu a:hover {
color: #fddb3a;
}
.navMenu .dot {
width: 6px;
height: 6px;
background: #fddb3a;
border-radius: 50%;
opacity: 0;
-webkit-transform: translateX(30px);
transform: translateX(30px);
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.navMenu a:nth-child(1):hover~.dot {
-webkit-transform: translateX(80px);
transform: translateX(80px);
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
opacity: 1;
}
.navMenu a:nth-child(2):hover~.dot {
-webkit-transform: translateX(240px);
transform: translateX(240px);
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
opacity: 1;
}
.navMenu a:nth-child(3):hover~.dot {
-webkit-transform: translateX(400px);
transform: translateX(400px);
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
opacity: 1;
}
.navMenu a:nth-child(4):hover~.dot {
-webkit-transform: translateX(570px);
transform: translateX(570px);
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
opacity: 1;
}
.overlay {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0, 0.9);
overflow-x: hidden;
transition: 0.5s;
}
.overlay-content {
position: relative;
top: 50%;
width: 100%;
text-align: center;
}
.overlay .closebtn {
position: absolute;
top: 20px;
margin-right: 20px;
right: 45px;
font-size: 120px;
}
.openNav {
font-size: 50px;
margin-left: 100px;
color: black;
}
#media screen and (max-width: 1305px) {
.dot {
display: none;
}
}
#media screen and (max-height: 450px) {
.overlay a {
font-size: 20px
}
.overlay .closebtn {
font-size: 40px;
top: 15px;
right: 35px;
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>City</title>
<link href="index.css" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="index.js"></script>
</head>
<body>
<div id="myNav" class="overlay">
×
<div class="overlay-content">
<nav class="navMenu">
Home
Blog
Work
About
<div class="dot"></div>
</nav>
</div>
</div>
<span class="openNav" style="cursor: pointer;" onclick="openNav()">☰</span>
</body>
</html>
I have a feeling it has something to do with the attribute being a span
That is right, because the span is by default has display: inline, and if you change it to display: block and apply some margin-top: 100px you see it changes the position.
.openNav{
display: block;
margin-top: 100px;
}
im crating a website for a school project. Right now I'm trying to get my headlines centered.
Unfortunatly I can't figure out how to center my h1. All the other headlines work just fine except that one.
I tried different methods of centering like the Bootstrap text-center class but none of them seem to work.
Is there any error I made? I would be grateful for help!
PS: Please excuse my bad english, I'm trying to get better at writing english without using a translator
<!doctype html>
<html lang="de">
<head>
<title>Virtual Reality - Headsetüberblick</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav id="colorlib-main-nav" role="navigation">
<i></i>
<div class="js-fullheight colorlib-table">
<div class="img" style="background-image: url(images/bg_3.jpg);"></div>
<div class="colorlib-table-cell js-fullheight">
<div class="row no-gutters">
<div class="col-md-12 text-center">
<h1 class="mb-4">Gruppe 1</h1>
<ul>
<li class="active"><span>Virtual Relity</span></li>
<li><span>Thema 2</span></li>
<li><span>Thema 3</span></li>
<li><span>Thema 4</span></li>
</ul>
</div>
</div>
</div>
</div>
</nav>
<!--<i></i>-->
<div class="introduction header h-100 container-fluid d-flex w-100 text-center">
<h1 id="h-100" class="h-100 row col-12 align-items-center text-center display-1">VIRTUAL REALITY</h1>
</div>
<div class="h-100 container-fluid row">
<h2 style="margin-top: 50px;" class="center col-12 text-center display-4">Was ist Virtual Reality (VR)</h2>
<p class="center col-12 lead">Eine virtuelle Welt oder ein Computerspiel, in das der Nutzer mit Hilfe eines VR-Headsets vollständig eintauchen kann</p>
</div>
<div class="footer-basic">
<footer>
<p class="copyright">Lukas Strutz 2021</p>
</footer>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
#font-face {
font-family: 'cf_glitch_cityregular';
src: url('fonts/cfglitchcityregular-l1vz-webfont.woff2') format('woff2'),
url('fonts/cfglitchcityregular-l1vz-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
html, body {
background-color: black;
color: white;
height: 100%;
min-height: 100%;
}
#h-100{
/*height: 100%;
min-height: 100%;*/
/*padding-top: 30%;
padding-bottom: 30%;*/
text-align: center;
}
/*h1 {
top: 50%;
transform: translateY(-50%);
}*/
h1{
font-family: "cf_glitch_cityregular";
}
.introduction {
background-image: url("beat-saber-intro.jpg");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
}
.sketchfab-embed-wrapper{
height: 100%;
margin-bottom: 200px;
}
iframe{
height: 100%;
width: 100%;
}
header {
height: 100%;
min-height: 100%;
}
.center{
text-align: center;
}
.steamvr{
background-image: url("https://www.vrnerds.de/wp-content/uploads/2016/02/Steam-VR-Spiele.png");
}
.oculus{
background-image: url("oculus.jpg");
}
/* Menu*/
.img {
background-size: cover;
background-repeat: no-repeat;
background-position: center center; }
#colorlib-main-nav {
position: absolute;
top: 0;
bottom: 0;
right: 0;
padding: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.99);
z-index: 1002;
text-align: center;
visibility: hidden;
opacity: 0;
-webkit-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
-moz-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
-ms-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
-o-transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
-webkit-transform: scale(0.1);
-moz-transform: scale(0);
-ms-transform: scale(0);
-o-transform: scale(0);
transform: scale(0);
overflow-y: scroll; }
#colorlib-main-nav .colorlib-table {
display: table;
width: 100%;
height: 100%; }
#colorlib-main-nav .colorlib-table .img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
height: 100%;
width: 100%;
opacity: 1; }
#colorlib-main-nav .colorlib-table .img:after {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: '';
background: rgba(0, 0, 0, 0.3); }
#colorlib-main-nav .colorlib-table .colorlib-table-cell {
display: table-cell;
vertical-align: middle; }
#colorlib-main-nav .colorlib-nav-toggle {
position: absolute;
top: 40px;
right: 40px;
padding: 20px;
height: 44px;
width: 44px;
line-height: 0;
padding: 0 !important;
visibility: hidden;
opacity: 0;
-webkit-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s; }
#media (prefers-reduced-motion: reduce) {
#colorlib-main-nav .colorlib-nav-toggle {
-webkit-transition: none;
-o-transition: none;
transition: none; } }
#colorlib-main-nav .colorlib-nav-toggle i {
top: 18px !important;
left: 0 !important;
margin: 0 !important;
padding: 0 !important;
line-height: 0;
text-indent: 0; }
#colorlib-main-nav .colorlib-nav-toggle.show {
visibility: visible;
opacity: 1; }
#colorlib-main-nav .colorlib-nav-toggle:hover i::before, #colorlib-main-nav .colorlib-nav-toggle:hover i::after {
content: '';
width: 40px;
height: 2px;
background: #fff;
position: absolute;
left: 0; }
.menu-show #colorlib-main-nav {
visibility: visible;
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1); }
#colorlib-main-nav .logo {
font-size: 40px;
color: #fff;
text-transform: uppercase;
letter-spacing: 2px;
font-weight: 700;
position: relative;
display: inline-block;
margin-bottom: 0;
line-height: 1.5;
font-family: "Poppins", Arial, sans-serif; }
#colorlib-main-nav .logo span {
font-size: 14px;
display: block;
font-weight: 300;
color: rgba(255, 255, 255, 0.8);
letter-spacing: 8px; }
#colorlib-main-nav ul {
padding: 0;
margin: 0;
display: block; }
#media (max-width: 767.98px) {
#colorlib-main-nav ul {
padding: 20px 0 0 0; } }
#colorlib-main-nav ul li {
padding: 0;
margin: 0;
list-style: none;
font-weight: 600;
font-size: 14px;
letter-spacing: 5px;
text-transform: uppercase; }
#colorlib-main-nav ul li a {
display: block;
color: white;
padding: 5px 0; }
#colorlib-main-nav ul li a span {
color: white;
position: relative;
padding: 0 10px; }
#colorlib-main-nav ul li a span small {
position: absolute;
bottom: 7px;
left: -30px;
font-size: 16px;
color: rgba(255, 255, 255, 0.3);
border-bottom: 1px solid rgba(255, 255, 255, 0.3); }
#colorlib-main-nav ul li a:hover, #colorlib-main-nav ul li a:active, #colorlib-main-nav ul li a:focus {
outline: none;
text-decoration: none; }
#colorlib-main-nav ul li a:hover span:before, #colorlib-main-nav ul li a:active span:before, #colorlib-main-nav ul li a:focus span:before {
visibility: visible;
-webkit-transform: scaleX(1);
-moz-transform: scaleX(1);
-ms-transform: scaleX(1);
-o-transform: scaleX(1);
transform: scaleX(1); }
#colorlib-main-nav ul li.active a span {
color: #f8b500; }
#colorlib-main-nav ul li.active a span:before {
background: #fec771;
visibility: visible;
-webkit-transform: scaleX(1);
-moz-transform: scaleX(1);
-ms-transform: scaleX(1);
-o-transform: scaleX(1);
transform: scaleX(1); }
header {
padding: 2em 0;
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 9;
margin: 0 auto; }
#media (max-width: 767.98px) {
header {
padding: 1em 0;
position: absolute; } }
header .colorlib-navbar-brand {
float: left; }
header .colorlib-navbar-brand .colorlib-logo {
font-size: 12px;
color: #fff;
letter-spacing: 5px;
font-weight: 600;
position: relative;
display: inline-block;
margin-bottom: 0;
line-height: 1.5;
font-family: "Poppins", Arial, sans-serif;
text-transform: uppercase; }
header .colorlib-navbar-brand .colorlib-logo span {
font-size: 11px;
display: block;
font-weight: 300;
color: rgba(255, 255, 255, 0.8);
letter-spacing: 7px; }
header .colorlib-navbar-brand .colorlib-logo i {
color: #fec771;
position: absolute;
top: -18px;
bottom: 0;
left: 7px;
font-size: 48px; }
header .colorlib-navbar-brand .colorlib-logo:hover {
text-decoration: none !important; }
header .colorlib-navbar-brand .colorlib-logo:active, header .colorlib-navbar-brand .colorlib-logo:focus {
outline: none;
text-decoration: none; }
.colorlib-nav-toggle {
cursor: pointer;
text-decoration: none; }
.colorlib-nav-toggle.active i::before, .colorlib-nav-toggle.active i::after {
background: #000; }
.colorlib-nav-toggle.dark.active i::before, .colorlib-nav-toggle.dark.active i::after {
background: #000; }
.colorlib-nav-toggle:hover, .colorlib-nav-toggle:focus, .colorlib-nav-toggle:active {
outline: none;
border-bottom: none !important; }
.colorlib-nav-toggle i {
position: relative;
display: inline-block;
width: 20px;
height: 2px;
color: #000;
font: bold 14px/.4 Helvetica;
text-transform: uppercase;
text-indent: -55px;
background: #fff;
-webkit-transition: all .2s ease-out;
-o-transition: all .2s ease-out;
transition: all .2s ease-out; }
.menu-show .colorlib-nav-toggle i {
background: #fff;
color: #fff; }
.colorlib-nav-toggle i::before, .colorlib-nav-toggle i::after {
content: '';
width: 30px;
height: 2px;
background: #fff;
position: absolute;
left: 0;
-webkit-transition: 0.2s;
-o-transition: 0.2s;
transition: 0.2s; }
.menu-show .colorlib-nav-toggle i::before, .menu-show .colorlib-nav-toggle i::after {
background: #fff; }
#media (prefers-reduced-motion: reduce) {
.colorlib-nav-toggle i::before, .colorlib-nav-toggle i::after {
-webkit-transition: none;
-o-transition: none;
transition: none; } }
.colorlib-nav-toggle.dark i {
position: relative;
color: #fff;
background: #fff;
-webkit-transition: all .2s ease-out;
-o-transition: all .2s ease-out;
transition: all .2s ease-out; }
.colorlib-nav-toggle.dark i::before, .colorlib-nav-toggle.dark i::after {
background: #fff;
-webkit-transition: 0.2s;
-o-transition: 0.2s;
transition: 0.2s; }
#media (prefers-reduced-motion: reduce) {
.colorlib-nav-toggle.dark i::before, .colorlib-nav-toggle.dark i::after {
-webkit-transition: none;
-o-transition: none;
transition: none; } }
.colorlib-nav-toggle i::before {
top: -7px; }
.colorlib-nav-toggle i::after {
bottom: -7px; }
.colorlib-nav-toggle:hover i::before {
top: -10px; }
.colorlib-nav-toggle:hover i::after {
bottom: -10px; }
.colorlib-nav-toggle.active i {
background: transparent; }
.colorlib-nav-toggle.active i::before {
top: 0;
-webkit-transform: rotateZ(45deg);
-moz-transform: rotateZ(45deg);
-ms-transform: rotateZ(45deg);
-o-transform: rotateZ(45deg);
transform: rotateZ(45deg); }
.colorlib-nav-toggle.active i::after {
bottom: 0;
-webkit-transform: rotateZ(-45deg);
-moz-transform: rotateZ(-45deg);
-ms-transform: rotateZ(-45deg);
-o-transform: rotateZ(-45deg);
transform: rotateZ(-45deg); }
.colorlib-nav-toggle {
float: right;
z-index: 1003;
position: relative;
top: 0;
right: 0;
display: block;
margin: 0 auto;
cursor: pointer;
margin-top: 0; }
#media (max-width: 767.98px) {
.colorlib-nav-toggle {
right: 10px; } }
.hero-wrap {
background: #202020; }
.hero-wrap .slider-text .desc h1 {
font-size: 6vw;
font-weight: 700;
color: #fff;
text-transform: uppercase; }
.hero-wrap .slider-text .desc h3 {
color: rgba(255, 255, 255, 0.8);
font-size: 18px; }
.footer-basic {
padding:40px 0;
background-color:#000;
/*color:#6b6c6d;*/
}
.footer-basic .copyright {
margin-top:15px;
text-align:center;
font-size:13px;
color:rgb(255, 255, 255);
margin-bottom:0;
}
/* Header: https://epicbootstrap.com/snippets/footer-basic */
Adding justify-content: center; to your <h1> element will make it centered.
So in your CSS file you could do this:
h1 {
font-family: "cf_glitch_cityregular";
justify-content: center;
}
justify-content Property
Please add the justify-content-center class on <h1> to Align the center.
Updated code :
<h1 id="h-100" class="h-100 row col-12 align-items-center text-center display-1 w-100 justify-content-center">VIRTUAL REALITY</h1>
I have been trying to create a mask over an image inside a div, but the mask does not cover the entire area of the div (leaves whitespace in the middle). Been trying to fix it but can't find a solution.
This is my progress - http://jsfiddle.net/E2aWr/164/
.image-container {
width: 254px;
height: 280px;
margin: 10px;
float: left;
border: 5px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
box-shadow: 0px 0px 5px #aaa;
cursor: default;
}
.image-container .mask, .image-container .content {
width: 250px;
height: 280px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
.image-container img {
display: block;
position: relative;
}
.image-container a.info {
background:url('link.png') center no-repeat;
display: inline-block;
text-decoration: none;
padding:0;
text-indent:-9999px;
width:20px;
height:20px;
}
.effect .mask {
opacity: 0;
overflow:visible;
border:100px solid rgba(0, 0, 0, 0.7);
box-sizing:border-box;
transition: all 0.4s ease-in-out;
}
.effect a.info {
position:relative;
top:-10px;
/* Center the link */
opacity: 0;
transition: opacity 0.5s 0s ease-in-out;
}
.effect:hover .mask {
opacity: 1;
border:100px solid rgba(0, 0, 0, 0.7);
}
.effect:hover a.info {
opacity:1;
transition-delay: 0.3s;
}
<div class="image-container effect">
<img src="http://www.istudy.net.my/images/shop/manufacturer/resized/bc_220x280.jpg.png" />
<div class="mask">
Full Image
</div>
</div>
because you have border not background, Remove border from mask and add background
.effect:hover .mask {
opacity: 1;
background-color:rgba(0,0,0,0.7);
}
.effect .mask {
opacity: 0;
overflow:visible;
box-sizing:border-box;
transition: all 0.4s ease-in-out;
}
I remove the border style in this selector .effect .mask and changed the border style to background style.
.image-container {
width: 254px;
height: 280px;
margin: 10px;
float: left;
border: 5px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
box-shadow: 0px 0px 5px #aaa;
cursor: default;
}
.image-container .mask,
.image-container .content {
width: 250px;
height: 280px;
position: absolute;
overflow: hidden;
top: 0;
left: 0;
}
.image-container img {
display: block;
position: relative;
}
.image-container a.info {
background: url('link.png') center no-repeat;
display: inline-block;
text-decoration: none;
padding: 0;
text-indent: -9999px;
width: 20px;
height: 20px;
}
.effect .mask {
opacity: 0;
overflow: visible;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
}
.effect a.info {
position: relative;
top: -10px;
/* Center the link */
opacity: 0;
transition: opacity 0.5s 0s ease-in-out;
}
.effect:hover .mask {
opacity: 1;
}
.effect:hover a.info {
opacity: 1;
transition-delay: 0.3s;
}
.effect .mask {
opacity: 0;
overflow: visible;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
}
.effect:hover .mask {
opacity: 1;
background: rgba(0, 0, 0, 0.7);
}
<div class="image-container effect">
<img src="http://www.istudy.net.my/images/shop/manufacturer/resized/bc_220x280.jpg.png" />
<div class="mask"> Full Image
</div>
</div>
Hope it helps.
I'm trying to gradually change an element's text while hovering, however it's not working for me.
I have this CSS:
.author-details > div a {
display: inline-block;
width: 30%;
float: none !important;
background-color: #1ABC9C;
color: #fff;
padding: 2% 3% 2% 3%;
border-radius: 7%;
font-weight: normal;
font-size: 16px;
-webkit-transition: background 0.35s linear;
-moz-transition: background 0.35s linear;
-ms-transition: background 0.35s linear;
-o-transition: background 0.35s linear;
transition: background 0.35s linear;
-webkit-box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
-moz-box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
box-shadow: 0px 5px 13px -8px rgba(0,0,0,0.45);
}
.author-details > div a:after {
content: 'Others';
}
.author-details > div a:hover {
background-color: #5DADE2;
}
.author-details > div a:hover:after {
-webkit-animation:fade-in 0.35s ease-in;
}
#-webkit-keyframes fade-in{
0%{
opacity:1;
top:0px;
}
50%{
opacity:0;
top:-5px;
content: 'Me';
}
100%{
opacity:1;
top:-5px;
}
}
And this HTML:
<div><label>View as: </label> </div>
However when I'm hovering on the element the text doesn't change. I want to make it change to "Me" when I'm hovering over it and return to "Others" when I'm not. How can I do that?
Here's a jsFiddle: http://jsfiddle.net/2fgy912p/
Code: http://codepen.io/anon/pen/Qbdvob
This effect works by using hover state to set opacity of absolutely positioned elements' opacity on and off. And they have transition applied so fade in and out effect is achieved.
Jade styled html:
.widget
span view as:
input(type='checkbox',id='toggle')
label.select(for='toggle')
.default others
.hovered you
Css:
* {
margin: 0;
padding: 0;
}
.widget {
font-family: Open Sans;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.widget span {
vertical-align: top;
line-height: 30px;
}
label.select {
user-select: none;
cursor: pointer;
background-color: #3ce;
color: #fff;
border-radius: 2px;
width: 60px;
vertical-align: top;
position: relative;
height: 30px;
display: inline-block;
}
label.select .default,
label.select .hovered {
transition: opacity 1s;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 1;
}
label.select .hovered {
opacity: 0;
}
label.select:hover {
background-color: #36f;
}
label.select .default {
opacity: 1;
}
label.select .hovered {
opacity: 0;
}
label.select:hover .default {
opacity: 0;
}
label.select:hover .hovered {
opacity: 1;
}
You're not defining text to replace when hover the link. Should be:
.author-details > div a:after {
content: 'Others';
}
.author-details > div a:hover:after {
content: 'Me';
}
FIDDLE: https://jsfiddle.net/lmgonzalves/2fgy912p/3/
EDIT1:
I make a few changes to add transitions. See if this is want you want: https://jsfiddle.net/lmgonzalves/2fgy912p/7/
EDIT2:
I hardcoded the top property on each element, that should work, although I see working fine. Check: https://jsfiddle.net/lmgonzalves/2fgy912p/9/
I have made a Menu with transitions in CSS3, but the problem is that the buttons that unfold dissapear when i try to hover over them, because of the transition that is just set on the Mainmenu DIV.
I could use some help!
Here is my jsfiddle: http://jsfiddle.net/7zn2D/
Here is my code:
<div id="mainmenu">
<div id="menu">MENU</div>
<div id="home">HOME</div>
<div id="video">VIDEO</div>
<div id="photos">>PHOTO'S</div>
<div id="calendar">CALENDAR</div>
</div>
#mainmenu {
position: fixed;
width: 100px;
height: 100px;
top: 400px;
right: -50px;
heigth: auto;
width: auto;
}
#mainmenu div {
color: #333333;
text-decoration: none;
font-size: 22px;
font-weight: 500;
position: fixed;
width: 100px;
height: 100px;
top: 400px;
right: -50px;
background: #333333;
text-align: center;
line-height: 100px;
transition: all 1s ease;
transform: rotate(45deg);
}
a {
display: block;
text-decoration: none;
}
#main_nav { list-style: none; margin: 0; padding: 0; }
#main_nav li a { /*text-indent: -999999px;*/ overflow: hidden; display: block; float: right;}
#menu {
z-index: 5;
}
#home {
z-index: 4;
}
#video {
z-index: 3;
}
#photos {
z-index: 2;
}
#calendar {
z-index: 2;
}
#menu:hover {
background: #FFFFFF;
}
#menu:hover ~ #home {
transition: all 0.3s ease;
transform: rotate(45deg) translate(0px,105px) perspective(350px);
}
#menu:hover ~ #photos {
transition: all 0.3s ease;
transition-delay: 0.3s;
transform: rotate(45deg) translate(0px,210px) perspective(350px);
}
#menu:hover ~ #video {
transition: all 0.3s ease;
transform: rotate(45deg) translate(-105px,0px) perspective(350px);
}
#menu:hover ~ #calendar {
transition: all 0.3s ease;
transition-delay: 0.3s;
transform: rotate(45deg) translate(-210px,0px) perspective(350px);
}
You need to apply the :hover event to the parent, #mainmenu. In order to do that, I made #mainmenu have position:fixed and absolutely positioned the children
#mainmenu {
position:fixed;
top: 300px;
right: -50px;
height:1px; width:1px;
}
#mainmenu div {
position:absolute;
right:0;
color: #333333;
text-decoration: none;
font-size: 22px;
font-weight: 500;
width: 100px;
height: 100px;
background: #333333;
text-align: center;
line-height: 100px;
transition: all 1s ease;
-webkit-transform: rotate(45deg);
}
a {
display: block;
color:white;
text-decoration: none;
transition: all 0.7s ease;
}
#menu:hover {
background: #FFFFFF;
}
#menu:hover a {
color:black;
}
#mainmenu:hover #menu ~ #home {
transition: all 0.3s ease;
-webkit-transform: rotate(45deg) translate(0px, 105px) perspective(350px);
}
#mainmenu:hover #menu ~ #photos {
transition: all 0.3s ease;
transition-delay: 0.3s;
-webkit-transform: rotate(45deg) translate(0px, 210px) perspective(350px);
}
#mainmenu:hover #menu ~ #video {
transition: all 0.3s ease;
-webkit-transform: rotate(45deg) translate(-105px, 0px) perspective(350px);
}
#mainmenu:hover #menu ~ #calendar {
transition: all 0.3s ease;
transition-delay: 0.3s;
-webkit-transform: rotate(45deg) translate(-210px, 0px) perspective(350px);
}
Demo here