I'm using a hover box in my application which shows a content on hover. However , I am not able to get the text in the middle when the box is NOT hovered.
This is my html:
<div class="container">
<div class="col-xs-3" style="padding-top: 20px;">
<div class="box box-type-double">
<div class="box-hover" href="#">
<div class="box-info">
<div class="date">
<p>Design Mixes</p>
</div>
<div class="line"></div>
<div class="headline">Mix Designs Grade of all concrete’s, DLC, PQC, BM, and DBM, BC.</div>
<div class="line"></div>
</div>
<div class="mask"></div>
</div>
<div class="box-content">Design Mixes</div>
</div>
</div>
</div>
This is my Css:
.box {
text-align: center;
/*float: left;*/
/*margin: 5px;*/
position: relative;
}
.box,
.box-hover,
.box-hover .mask,
.box-img,
.box-info {
background-color: #b4a28f;
}
.box-hover,
.box-hover .mask,
.box-img {
position: absolute;
top: 0;
left: 0;
}
.box-type-double .box-hover {
z-index: 5;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
cursor: pointer;
display: block;
text-decoration: none;
text-align: center;
}
.box-type-double .box-info {
z-index: 10;
color: #ffffff;
display: table-cell;
vertical-align: middle;
position: relative;
z-index: 5;
height: 200px;
}
.box-type-double .box-info .headline {
font-size: 15px;
width: 90%;
margin: 0 auto;
}
.box-type-double .box-info .line {
height: 2px;
width: 0%;
margin: 15px auto;
background-color: #ffffff;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box-type-double .box-info .date {
font-size: 10px;
}
.box-type-double .box-hover .mask {
background-color: #000;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity: 0.5;
z-index: 0;
}
.box-type-double .box-hover:hover .line {
width: 90%;
}
.box-type-double .box-hover:hover {
opacity: 1;
}
.box-content {
font-size: 15px;
background-color: #3178b9;
color: white;
z-index: 0;
height: 200px;
}
Plunker link : https://plnkr.co/edit/2TiWlPG7cVIQ56zR5UGX
Put it in a span and apply flex to box-content
.box {
text-align: center;
/*float: left;*/
/*margin: 5px;*/
position: relative;
}
.box,
.box-hover,
.box-hover .mask,
.box-img,
.box-info {
background-color: #b4a28f;
}
.box-hover,
.box-hover .mask,
.box-img {
position: absolute;
top: 0;
left: 0;
}
.box-type-double .box-hover {
z-index: 5;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
cursor: pointer;
display: block;
text-decoration: none;
text-align: center;
}
.box-type-double .box-info {
z-index: 10;
color: #ffffff;
display: table-cell;
vertical-align: middle;
position: relative;
z-index: 5;
height: 200px;
}
.box-type-double .box-info .headline {
font-size: 15px;
width: 90%;
margin: 0 auto;
}
.box-type-double .box-info .line {
height: 2px;
width: 0%;
margin: 15px auto;
background-color: #ffffff;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box-type-double .box-info .date {
font-size: 10px;
}
.box-type-double .box-hover .mask {
background-color: #000;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity: 0.5;
z-index: 0;
}
.box-type-double .box-hover:hover .line {
width: 90%;
}
.box-type-double .box-hover:hover {
opacity: 1;
}
.box-content {
font-size: 15px;
background-color: #3178b9;
color: white;
z-index: 0;
height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
<div class="container">
<div class="col-xs-3" style="padding-top: 20px;">
<div class="box box-type-double">
<div class="box-hover" href="#">
<div class="box-info">
<div class="date">
<p>Design Mixes</p>
</div>
<div class="line"></div>
<div class="headline">Mix Designs Grade of all concrete’s, DLC, PQC, BM, and DBM, BC.</div>
<div class="line"></div>
</div>
<div class="mask"></div>
</div>
<div class="box-content"><span>Design Mixes<span></div>
</div>
</div>
</div>
.box-hover {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.box-type-double .box-info {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
}
Let's check it out !
Related
I tried to put some contents over an image with some overlay effects, but it does not shows output as my needs. Also I don't know how to do overlay effects anyone can help me please.
.destination {
padding: 20px;
-ms-transform: translate(0, 0);
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
transition: all .5s ease;
-ms-transition: all .5s ease;
-webkit-transition: all .5s ease;
}
.destination h3 {
font-size: 25px;
color: #fff;
line-height: 20px;
text-transform: uppercase;
margin-bottom: 10px;
}
.destination span {
display: block;
font-size: 15px;
color: #fff;
line-height: 16px;
}
.overlay-leftTop {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 9;
transition: all .3s ease;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
}
.destinationmask {
width: 100%;
height: 100%;
z-index: 5;
opacity: 0.4;
filter: alpha(opacity=50);
background: #000;
}
<img src="https://image.ibb.co/evyyfm/mu.jpg" alt="img01"/>
<a href="" class="overlay-leftTop">
<div class="table-display">
<div class="table-cell table-cell-bottom">
<div class="destination">
<h3>TEST</h3>
<span>Check,check1,check2</span>
</div>
</div>
</div>
Actually I need something like this
You should use background-image CSS property instead of <img> tag. And for effects use pseudo elements like :before.
Have a look at the snippet below:
.destination {
padding: 20px;
-ms-transform: translate(0, 0);
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
transition: all .5s ease;
-ms-transition: all .5s ease;
-webkit-transition: all .5s ease;
}
.destination h3 {
font-size: 25px;
color: #fff;
line-height: 20px;
text-transform: uppercase;
margin-bottom: 10px;
}
.destination span {
display: block;
font-size: 15px;
color: #fff;
line-height: 16px;
}
.overlay-leftTop {
display: block;
position: relative;
text-decoration: none;
width: 300px;
height: 300px;
z-index: 9;
transition: all .3s ease;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
}
.overlay-leftTop:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 1;
background: rgba(0,0,0,0.3);
transition: all .3s ease;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
}
.overlay-leftTop:hover {
text-decoration: none;
}
.overlay-leftTop:hover:before {
background: rgba(0,0,0,0.5);
}
.destinationmask {
width: 100%;
height: 100%;
z-index: 5;
opacity: 0.4;
filter: alpha(opacity=50);
background: #000;
}
<a href="" class="overlay-leftTop" style="background-image: url('https://image.ibb.co/evyyfm/mu.jpg');">
<div class="table-display">
<div class="table-cell table-cell-bottom">
<div class="destination">
<h3>TEST</h3>
<span>Check,check1,check2</span>
</div>
</div>
</div>
</a>
Hope this helps!
I think this is what u want.
.destination {
padding: 20px;
-ms-transform: translate(0, 0);
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
transition: all .5s ease;
-ms-transition: all .5s ease;
-webkit-transition: all .5s ease;
}
.destination h3 {
font-size: 25px;
color: #fff;
line-height: 20px;
text-transform: uppercase;
margin-bottom: 10px;
}
.destination span {
display: block;
font-size: 15px;
color: #fff;
line-height: 16px;
}
.overlay-leftTop {
display: block;
position: relative;
text-decoration: none;
width: 300px;
height: 300px;
z-index: 9;
transition: all .3s ease;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
}
.overlay-leftTop:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 1;
background: rgba(0,0,0,0.3);
transition: all .3s ease;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
}
.overlay-leftTop:hover {
text-decoration: none;
}
.overlay-leftTop:hover:before {
background: rgba(0,0,0,0.5);
}
.destinationmask {
width: 100%;
height: 100%;
z-index: 5;
opacity: 0.4;
filter: alpha(opacity=50);
background: #000;
}
.view-btn{
position: absolute;
top: 180px;
font-size: 16px !important;
border: 2px solid #fff;
display: inline-block !important;
text-align: center;
padding: 10px 15px;
opacity: 0;
transition:all 350ms ease 0s;
}
.overlay-leftTop:hover .view-btn{
opacity:1;
}
<a href="" class="overlay-leftTop" style="background-image: url('https://image.ibb.co/evyyfm/mu.jpg');">
<div class="table-display">
<div class="table-cell table-cell-bottom">
<div class="destination">
<h3>TEST</h3>
<span>Check,check1,check2</span>
<span class="view-btn">View More</Span>
</div>
</div>
</div>
</a>
Please try this. I have added some css:
.img-wrap {
display: inline-block;
position: relative;
width: 386px;
}
.img-box:before {
position: absolute;
content: "";
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.4);
transform:scale(0);
transition: all .5s ease;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
}
.img-wrap:hover .img-box:before {
transform:scale(1);
}
.img-wrap:hover .overlay-leftTop{
opacity:1;
}
img {
height: auto;
max-height: 100%;
max-width: 100%;
width: auto;
display: block;
}
.destination {
padding: 20px;
-ms-transform: translate(0, 0);
-webkit-transform: translate(0, 0);
transform: translate(0, 0);
transition: all .5s ease;
-ms-transition: all .5s ease;
-webkit-transition: all .5s ease;
}
.destination h3 {
font-size: 25px;
color: #fff;
line-height: 20px;
text-transform: uppercase;
margin-bottom: 10px;
}
.destination span {
display: block;
font-size: 15px;
color: #fff;
line-height: 16px;
}
.overlay-leftTop {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
opacity:0;
transition: all .5s ease;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
}
.img-wrap {
display: inline-block;
position: relative;
width: 386px;
}
.img-box:before {
position: absolute;
content: "";
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.4);
transform:scale(0);
transition: all .5s ease;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
}
.img-wrap:hover .img-box:before {
transform:scale(1);
}
.img-wrap:hover .overlay-leftTop{
opacity:1;
}
img {
height: auto;
max-height: 100%;
max-width: 100%;
width: auto;
display: block;
}
<div class="img-wrap">
<div class="img-box">
<img src="https://image.ibb.co/evyyfm/mu.jpg" alt="img01"/>
</div>
<a href="" class="overlay-leftTop">
<div class="table-display">
<div class="table-cell table-cell-bottom">
<div class="destination">
<h3>TEST</h3>
<span>Check,check1,check2</span>
</div>
</div>
</div>
</a>
</div>
I don't know how to solve this problem: on hover of 'a' elements the div enlarges and the other 'a' move.
Thanks for help
https://jsfiddle.net/0r2v2qyp/
Here html:
<a id="btn_agency" class="btn_presentation">Agenzia</a>
<a id="btn_student" class="btn_presentation">Studente</a>
<a id="btn_prof" class="btn_presentation">Docente</a>
<a id="btn_admin" class="btn_presentation">Segreteria</a>
And css:
.btn_presentation {
float: left;
margin: 10px;
color: royalblue;
font-size: 20px;
position: relative;
letter-spacing: 0;
text-transform: uppercase;
transition: all .2s ease-out;
}
.btn_presentation:after {
content: '';
position: relative;
display: block;
margin: 0 auto;
width: 0;
height: 0;
background: red;
transition: all .2s ease-out;
}
.btn_presentation:hover {
letter-spacing: 5px;
transition: all .3s ease-in;
}
.btn_presentation:hover:after {
width: 100%;
height: 2px;
transition: all .2s ease-in-out;
}
To be able to animate the letter-spacing, you have to give the div a fixed width wide enough to make up for the text when expanded.
div {
display: inline-block;
margin: 10px;
width: 120px;
}
.btn_presentation {
display: inline-block;
color: royalblue;
font-size: 20px;
position: relative;
letter-spacing: 0;
text-transform: uppercase;
transition: all .2s ease-out;
}
.btn_presentation:after {
content: '';
position: relative;
display: block;
margin: 0 auto;
width: 0;
height: 0;
background: red;
transition: all .2s ease-out;
}
.btn_presentation:hover {
letter-spacing: 5px;
transition: all .3s ease-in;
}
.btn_presentation:hover:after {
width: 100%;
height: 2px;
transition: all .2s ease-in-out;
}
<div>
<a id="btn_agency" class="btn_presentation">Agenzia</a>
</div>
<div>
<a id="btn_student" class="btn_presentation">Studente</a>
</div>
<div>
<a id="btn_prof" class="btn_presentation">Docente</a>
</div>
<div>
<a id="btn_admin" class="btn_presentation">Segreteria</a>
</div>
An option could instead be to scale it using transform
div {
display: inline-block;
margin: 10px;
}
.btn_presentation {
display: inline-block;
color: royalblue;
font-size: 20px;
position: relative;
letter-spacing: 0;
text-transform: uppercase;
transition: transform .2s ease-out;
}
.btn_presentation:after {
content: '';
position: relative;
display: block;
margin: 0 auto;
width: 0;
height: 2px;
background: red;
transition: width .2s ease-out;
}
.btn_presentation:hover {
transform: scale(1.2);
transition: transform .3s ease-in;
}
.btn_presentation:hover:after {
width: 100%;
transition: width .2s ease-in-out;
}
<div>
<a id="btn_agency" class="btn_presentation">Agenzia</a>
</div>
<div>
<a id="btn_student" class="btn_presentation">Studente</a>
</div>
<div>
<a id="btn_prof" class="btn_presentation">Docente</a>
</div>
<div>
<a id="btn_admin" class="btn_presentation">Segreteria</a>
</div>
Updated based on comment
This stretch the word only side ways
div {
display: inline-block;
margin: 10px;
}
.btn_presentation {
display: inline-block;
color: royalblue;
font-size: 20px;
position: relative;
letter-spacing: 0;
text-transform: uppercase;
transition: transform .2s ease-out;
}
.btn_presentation:after {
content: '';
position: relative;
display: block;
margin: 0 auto;
width: 0;
height: 2px;
background: red;
transition: width .2s ease-out;
}
.btn_presentation:hover {
transform: scaleX(1.2);
transition: transform .3s ease-in;
}
.btn_presentation:hover:after {
width: 100%;
transition: width .2s ease-in-out;
}
<div>
<a id="btn_agency" class="btn_presentation">Agenzia</a>
</div>
<div>
<a id="btn_student" class="btn_presentation">Studente</a>
</div>
<div>
<a id="btn_prof" class="btn_presentation">Docente</a>
</div>
<div>
<a id="btn_admin" class="btn_presentation">Segreteria</a>
</div>
I have the following CSS sheet for a responsive flip card that is displaying two background images on both sides. I am trying to get text on top of them, but it is not showing in the browser for some reason. Here is the CSS:
.container {
padding: 1em;
margin: 0px auto;
max-width: 100%;
text-align: center;
-webkit-perspective: 800px;
perspective: 800px;
}
.card {
width: 90%;
border-radius:20px;
height: 170px;
margin: 10 auto;
position: relative;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.face:after {
position: absolute;
top: 100%;
left: 0;
z-index: -1;
display: block;
content: '';
height: 22px;
width: 100%;
background: url('http://media.a-g.fr/crea/talenance/shadow.png') no-repeat;
background-size: 100%;
}
.face {
border-radius:20px;
position: absolute;
width: 100%;
height: 100%;
text-align: center;
line-height: 300px;
color: white;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transition: 0.3s all ease-in-out;
-webkit-transition: 0.3s all ease-in-out;
-moz-transition: 0.3s all ease-in-out;
}
.front {
background: url(https://s3.amazonaws.com/uifaces/faces/twitter/eomerx/128.jpg) center center;
background-size:cover;
z-index: 2;
text-align: center;
font-size: 4em;
position: absolute;
}
.back {
z-index: 1;
background-color: #28255f;
transform:rotateY(180deg);
}
.back a {
line-height: 250px;
font-size: 14px;
font-weight: 700;
text-decoration: none;
width: 100%;
height: 50%;
text-align: center;
color: black;
display: block;
transition: 0.3s all ease-in-out;
-webkit-transition: 0.3s all ease-in-out;
-moz-transition: 0.3s all ease-in-out;
}
.back a:before {
content:"";
background-size:cover;
position: absolute;
width:50px;
height: 50px;
left:0;
right:0;
margin:0 auto;
filter:invert(100%) brightness(150%);
-webkit-filter:invert(100%) brightness(150%);
}
.back a:nth-of-type(1):before {
background:url(http://media.a-g.fr/crea/talenance/linkedin.png) no-repeat center center;
top:30px;
}
.back a:nth-of-type(2):before {
background:url(http://media.a-g.fr/crea/talenance/email.png) no-repeat center center;
bottom:30px;
}
.back a:hover {
opacity:0.5;
}
.card:hover .front {
transform:rotateY(-180deg);
}
.card:hover .back {
transform:rotateY(0deg);
}
I am trying to insert text there on top of the background image, but I am not sure why this HTML doesn't work:
<div class="container">
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 cardContainer">
<div class="card" id="card">
<div class="face front">
TEXT HERE
</div>
<div class="face back">
</div>
</div>
</div>
</div>
Thank for your help!
Add line-height:1; to class front or remove line-height: 300px; from class face, depending on your use for class face elsewhere.
.container {
padding: 1em;
margin: 0px auto;
max-width: 100%;
text-align: center;
-webkit-perspective: 800px;
perspective: 800px;
}
.card {
width: 90%;
border-radius:20px;
height: 170px;
margin: 10 auto;
position: relative;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.face:after {
position: absolute;
top: 100%;
left: 0;
z-index: -1;
display: block;
content: '';
height: 22px;
width: 100%;
background: url('http://media.a-g.fr/crea/talenance/shadow.png') no-repeat;
background-size: 100%;
}
.face {
border-radius:20px;
position: absolute;
width: 100%;
height: 100%;
text-align: center;
line-height: 300px;
color: white;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transition: 0.3s all ease-in-out;
-webkit-transition: 0.3s all ease-in-out;
-moz-transition: 0.3s all ease-in-out;
}
.front {
background: url(https://s3.amazonaws.com/uifaces/faces/twitter/eomerx/128.jpg) center center;
background-size:cover;
z-index: 2;
text-align: center;
font-size: 4em;
position: absolute;
line-height:1;
}
.back {
z-index: 1;
background-color: #28255f;
transform:rotateY(180deg);
}
.back a {
line-height: 250px;
font-size: 14px;
font-weight: 700;
text-decoration: none;
width: 100%;
height: 50%;
text-align: center;
color: black;
display: block;
transition: 0.3s all ease-in-out;
-webkit-transition: 0.3s all ease-in-out;
-moz-transition: 0.3s all ease-in-out;
}
.back a:before {
content:"";
background-size:cover;
position: absolute;
width:50px;
height: 50px;
left:0;
right:0;
margin:0 auto;
filter:invert(100%) brightness(150%);
-webkit-filter:invert(100%) brightness(150%);
}
.back a:nth-of-type(1):before {
background:url(http://media.a-g.fr/crea/talenance/linkedin.png) no-repeat center center;
top:30px;
}
.back a:nth-of-type(2):before {
background:url(http://media.a-g.fr/crea/talenance/email.png) no-repeat center center;
bottom:30px;
}
.back a:hover {
opacity:0.5;
}
.card:hover .front{
transform:rotateY(-180deg);
}
.card:hover .back{
transform:rotateY(0deg);
}
<div class="container">
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 cardContainer">
<div class="card" id="card">
<div class="face front">
TEXT HERE
</div>
<div class="face back">
</div>
</div>
</div>
Remove the line-height from .face selector.
Final css:
.container {
padding: 1em;
margin: 0px auto;
max-width: 100%;
text-align: center;
-webkit-perspective: 800px;
perspective: 800px;
}
.card {
width: 90%;
border-radius:20px;
height: 170px;
margin: 10 auto;
position: relative;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.face:after {
position: absolute;
top: 100%;
left: 0;
z-index: -1;
display: block;
content: '';
height: 22px;
width: 100%;
background: url('http://media.a-g.fr/crea/talenance/shadow.png') no-repeat;
background-size: 100%;
}
.face {
border-radius:20px;
position: absolute;
width: 100%;
height: 100%;
text-align: center;
/*line-height: 300px;*/
color: white;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transition: 0.3s all ease-in-out;
-webkit-transition: 0.3s all ease-in-out;
-moz-transition: 0.3s all ease-in-out;
}
.front {
background: url(https://s3.amazonaws.com/uifaces/faces/twitter/eomerx/128.jpg) center center;
background-size:cover;
z-index: 2;
text-align: center;
font-size: 4em;
position: absolute;
}
.back {
z-index: 1;
background-color: #28255f;
transform:rotateY(180deg);
}
.back a {
line-height: 250px;
font-size: 14px;
font-weight: 700;
text-decoration: none;
width: 100%;
height: 50%;
text-align: center;
color: black;
display: block;
transition: 0.3s all ease-in-out;
-webkit-transition: 0.3s all ease-in-out;
-moz-transition: 0.3s all ease-in-out;
}
.back a:before {
content:"";
background-size:cover;
position: absolute;
width:50px;
height: 50px;
left:0;
right:0;
margin:0 auto;
filter:invert(100%) brightness(150%);
-webkit-filter:invert(100%) brightness(150%);
}
.back a:nth-of-type(1):before {
background:url(http://media.a-g.fr/crea/talenance/linkedin.png) no-repeat center center;
top:30px;
}
.back a:nth-of-type(2):before {
background:url(http://media.a-g.fr/crea/talenance/email.png) no-repeat center center;
bottom:30px;
}
.back a:hover {
opacity:0.5;
}
.card:hover .front{
transform:rotateY(-180deg);
}
.card:hover .back{
transform:rotateY(0deg);
}
Demo: https://jsfiddle.net/v5g9eg1e/
CSS I hope this is what you are looking For.
.container {
padding: 1em;
margin: auto;
max-width: 100%;
text-align: center;
-webkit-perspective: 800px;
perspective: 800px;
}
.card {
width: 90%;
border-radius:20px;
height: 170px;
margin: 10 auto;
position: relative;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.face:after {
position: absolute;
top: 100%;
left: 0;
z-index: -1;
display: block;
content: '';
height: 22px;
width: 100%;
background: url('http://media.a-g.fr/crea/talenance/shadow.png') no-repeat;
background-size: 100%;
}
.face {
border-radius:20px;
position: absolute;
width: 100%;
height: 100%;
text-align: center;
line-height: 300px;
color: white;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
transition: 0.3s all ease-in-out;
-webkit-transition: 0.3s all ease-in-out;
-moz-transition: 0.3s all ease-in-out;
}
.front {
background: url(https://s3.amazonaws.com/uifaces/faces/twitter/eomerx/128.jpg) center center;
background-size:cover;
z-index: 2;
text-align: center;
font-size: 4em;
position: absolute;
}
.back {
z-index: 1;
background-color: #28255f;
transform:rotateY(180deg);
}
.back a {
line-height: 250px;
font-size: 14px;
font-weight: 700;
text-decoration: none;
width: 100%;
height: 50%;
text-align: center;
color: black;
display: block;
transition: 0.3s all ease-in-out;
-webkit-transition: 0.3s all ease-in-out;
-moz-transition: 0.3s all ease-in-out;
}
.back a:before {
content:"";
background-size:cover;
position: absolute;
width:50px;
height: 50px;
left:0;
right:0;
margin:0 auto;
filter:invert(100%) brightness(150%);
-webkit-filter:invert(100%) brightness(150%);
}
.back a:nth-of-type(1):before {
background:url(http://media.a-g.fr/crea/talenance/linkedin.png) no-repeat center center;
top:30px;
}
.back a:nth-of-type(2):before {
background:url(http://media.a-g.fr/crea/talenance/email.png) no-repeat center center;
bottom:30px;
}
.back a:hover {
opacity:0.5;
}
.card:hover .front {
transform:rotateY(-180deg);
}
.card:hover .back {
transform:rotateY(0deg);
}
#text {
text-align: center}
HTML
<div id="text">
<h2>TEXT HERE<h2>
</div>
<div class="container">
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 cardContainer">
<div class="card" id="card">
<div class="face front">
</div>
<div class="face back">
</div>
</div>
</div>
Trying to make icons fade to .5 opacity and have link text fade in to 1.0 opacity at the same time. I can only get one to work. Trying to fix this without totally revamping the css and html if possible.
I'm trying to do this for the shop online store icons of this website:
http://mbc.milkstreetmarketing.com/.
.shoprow {
margin-bottom: 10px;
height: 100%;
width: 80%;
margin: 0 auto;
text-align: center;
padding-top: 2%;
padding-bottom: 4%;
}
.icons {
display: inline-block;
width: 11%;
padding: 0 10%;
position: relative;
}
.comingsoon {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: #8ddc2b !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.comingsoon:hover {
opacity: 1;
}
.shopnow {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: red !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.shopnow:hover {
opacity: 1;
}
.shoptitlesactive {
left: 0;
right: 0;
position: absolute;
color: #8ddc2b !important;
font-weight: bold;
}
.shoptitlesinactive {
left: 0;
right: 0;
position: absolute;
color: #bcbdc0 !important;
font-weight: bold;
}
<div id="shopwrapper">
<div id="shopoverlay">
<div id="shopstore">Shop Online Store</div>
<div class="shoprow">
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-2.png" class="imgicon"></img>
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ABRASIVES</p>
</div>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-6.png">
<p class="shopnow">Shop Now!</p>
<p class="shoptitlesactive">DRILLING</p>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-1.png">
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ELECTRICAL</p>
</div>
</div>
</div>
</div>
</div>
Have you tried something like this?
.icons:hover .shopnow, .icons:hover .comingsoon{
opacity: 1;
}
.icons:hover img{
opacity: .5;
}
Then you can remove these:
.shopnow:hover {
opacity: 1;
}
.comingsoon:hover {
opacity: 1;
}
I think you are looking for the + selector:
.imgicon:hover + .comingsoon, .comingsoon:hover {
opacity: 1;
}
.imgicon {
transition: opacity .5s ease-in-out;
}
.imgicon:hover {
opacity: 0.5;
}
When you hover .imgicon or .comingsoon, opacity: 1 is applied to .commingsoon. And when you hover .imgicon, opacity: 0.5 is applied to it.
.shoprow {
margin-bottom: 10px;
height: 100%;
width: 80%;
margin: 0 auto;
text-align: center;
padding-top: 2%;
padding-bottom: 4%;
}
.icons {
display: inline-block;
width: 11%;
padding: 0 10%;
position: relative;
}
.comingsoon {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: #8ddc2b !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.imgicon:hover + .comingsoon, .comingsoon:hover {
opacity: 1;
}
.imgicon {
transition: opacity .5s ease-in-out;
}
.imgicon:hover {
opacity: 0.5;
}
.shopnow {
position: absolute;
top: 40%;
left: 0;
right: 0;
font-size: 2vw;
color: red !important;
font-weight: bold !important;
opacity: 0;
transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
}
.shopnow:hover {
opacity: 1;
}
.shoptitlesactive {
left: 0;
right: 0;
position: absolute;
color: #8ddc2b !important;
font-weight: bold;
}
.shoptitlesinactive {
left: 0;
right: 0;
position: absolute;
color: #bcbdc0 !important;
font-weight: bold;
}
<div id="shopwrapper">
<div id="shopoverlay">
<div id="shopstore">
Shop Online Store
</div>
<div class="shoprow">
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-2.png" class="imgicon"></img>
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ABRASIVES</p>
</div>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-6.png">
<p class="shopnow">Shop Now!</p>
<p class="shoptitlesactive">DRILLING</p>
</div>
<div class="icons">
<img src="http://mbc.milkstreetmarketing.com/wp-content/uploads/2015/06/Icon-1.png">
<p class="comingsoon">Coming Soon!</p>
<p class="shoptitlesinactive">ELECTRICAL</p>
</div>
</div>
I have created div called "footer" it appears always at the bottom when the page loads and goes up when scrolling down. Right now I am trying to position 2x text fields using col-6-lg(bootstrap), they should be under the "footer" and visible after scrolling.
body{
background-image: url("../img/bg.png");
background-size: cover;
background-color: #01383b;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
}
#content {
background: #D0E5FF;
padding: 20px;
color: #00214B;
font-family: sans-serif;
font-weight: bold;
font-size: 14px;
line-height: 1.8;
}
#footer {
opacity: 0.8;
filter: alpha(opacity=40);
background: rgb(14, 122, 128);
line-height: 2;
text-align: center;
color: #042E64;
font-size: 30px;
font-family: sans-serif;
font-weight: bold;
text-shadow: 0 1px 0 #84BAFF;
box-shadow: 0 0 15px #00214B
}
#button1{
margin-top: 15px;
}
#button2{
margin-top: 15px;
margin-left: 95px;
}
.cd-container {
width: 90%;
max-width: 768px;
margin: 2em auto;
}
.cd-container::after {
/* clearfix */
content: '';
display: table;
clear: both;
}
.cd-top {
display: inline-block;
height: 40px;
width: 40px;
position: fixed;
bottom: 40px;
right: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
background: #3cd8e1 url(../img/cd-top-arrow.svg) no-repeat center 50%;
visibility: hidden;
opacity: 0;
-webkit-transition: opacity .3s 0s, visibility 0s .3s;
-moz-transition: opacity .3s 0s, visibility 0s .3s;
transition: opacity .3s 0s, visibility 0s .3s;
}
.cd-top.cd-is-visible, .cd-top.cd-fade-out, .no-touch .cd-top:hover {
-webkit-transition: opacity .3s 0s, visibility 0s 0s;
-moz-transition: opacity .3s 0s, visibility 0s 0s;
transition: opacity .3s 0s, visibility 0s 0s;
}
.cd-top.cd-is-visible {
visibility: visible;
opacity: 1;
}
.cd-top.cd-fade-out {
opacity: .5;
}
.no-touch .cd-top:hover {
background-color: #3cd8e1;
opacity: 1;
}
#media only screen and (min-width: 768px) {
.cd-top {
right: 20px;
bottom: 20px;
}
}
#media only screen and (min-width: 1024px) {
.cd-top {
height: 60px;
width: 60px;
right: 30px;
bottom: 30px;
}
}
.content{
font-family: 'Open Sans';
color: #fff;
}
<div id="footer">
<div class="container">
<div class="col-lg-8 col-lg-offset-2 text-center">
<input type="image" src="img/true.png" alt="Submit" width="78" height="78" id="button1">
<input type="image" src="img/false.png" alt="Submit" width="78" height="78" id="button2">
</div>
<div class="col-lg-4 pull-right">
Top
</div>
</div>
</div>
<div class="container">
<div class="col-lg-6 pull-left text-center">
<h1>Да, това е!</h1>
</div>
<div class="col-lg-6 pull-left text-center">
<h1>Не, това е Lorem Ipsum</h1>
</div>
</div>
So here is the possible solution.
You can wrap both boxes (footer and under-footer container) into, let's call it: footer-wrap.
Then, set .footer-wrap {position: absolute;bottom: 0;width: 100%;}
And remove positioning classes for #footer from your styles.
/* #footer {
position: absolute;
bottom: 0;
width: 100%;
}*/
Set:
.footer-wrap {
position: absolute;
bottom: 0;
width: 100%;
}
Here is a demo: https://jsfiddle.net/xvwqt9a0/
Also here is a demo with your style and your html: https://jsfiddle.net/xvwqt9a0/1/