I am coding a page to select different products. each 'bild box' in my HTML is supposed to display a product and when you hover with you mouse over it, it zooms into the picture and a few other styling effects happen. When hovering over the boxes you can see, that randomly the boxes zoom and it looks glitchy. Here is a demonstration of the effect: https://streamable.com/wei69
I have tried to specify the different hover boxes which makes the code unnecessarily long and didn't fix the problem. Before I did this there were no classes like 'title1, title2' it was only 'title'.
I also tried different browsers and in Safari the effect isn't that bad but it is still not user friendly.
Here is my code:
#flex-container {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-ms-flex-pack: distribute;
justify-content: space-around;
}
.bildbox1,
.bildbox2,
.bildbox3,
.bildbox4,
.bildbox5,
.bildbox6 {
width: 100vw;
margin-left: calc(50% - 50vw);
height: 300px;
overflow: hidden;
text-align: center;
}
.bild1,
.bild2,
.bild3,
.bild4,
.bild5 {
width: 100%;
height: 100%;
background-color: black;
/* fallback color */
background-position: center;
background-size: cover;
-webkit-transition: all .3s ease;
}
.bild1 {
background-image: url("//cdn.shopify.com/s/files/1/0031/3252/2611/files/selfie-413162_960_720_large.jpg?v=1549398130");
}
.bild2 {
background-image: url("//cdn.shopify.com/s/files/1/0031/3252/2611/files/selfie-413162_960_720_large.jpg?v=1549398130");
}
.bild3 {
background-image: url("//cdn.shopify.com/s/files/1/0031/3252/2611/files/selfie-413162_960_720_large.jpg?v=1549398130");
}
.bild4 {
background-image: url("//cdn.shopify.com/s/files/1/0031/3252/2611/files/selfie-413162_960_720_large.jpg?v=1549398130");
}
.bild5 {
background-image: url("//cdn.shopify.com/s/files/1/0031/3252/2611/files/selfie-413162_960_720_large.jpg?v=1549398130");
}
.textbox {
background-color: #F2F2F2;
height: 100%;
padding-top: 20%;
text-align: center;
}
.textbox p {
color: darkgrey;
}
.point1,
.point2,
.point3,
.point4,
.point5 {
width: 75px;
margin: auto;
position: absolute;
top: 10px;
left: 0;
bottom: 0;
right: 0;
height: 1px;
background: white;
-webkit-transition: width .3s ease;
-o-transition: width .3s ease;
transition: width .3s ease;
display: none;
}
.konfigurieren-button1,
.konfigurieren-button2,
.konfigurieren-button3,
.konfigurieren-button4,
.konfigurieren-button5 {
background: #E30D27;
color: white;
padding: 0 10px;
text-align: center;
height: 30px;
line-height: 1.2;
vertical-align: top;
font-weight: bold;
font-size: 10px;
#include inline-flexbox();
#include align-items(center);
#include justify-content(center);
-webkit-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
-webkit-appearance: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-smoothing: antialiased;
border-radius: 100px;
position: relative;
top: 50px;
z-index: 99;
}
.title1,
.title2,
.title3,
.title4,
.title5 {
color: #ffffff !important;
font-family: sans-serif;
text-align: center;
margin: auto;
position: relative;
top: 100px;
left: 0;
bottom: 0;
right: 0;
height: 50px;
display: block;
color: white;
padding: 25%;
}
.konfigurieren-button1:hover,
.konfigurieren-button2:hover,
.konfigurieren-button3:hover,
.konfigurieren-button4:hover,
.konfigurieren-button5:hover,
{
color: black;
background-color: white;
}
#media (hover: hover) {
.bildbox1:hover .bild1,
.bildbox1:focus .bild1 {
-webkit-transform: scale(1.15);
-ms-transform: scale(1.15);
transform: scale(1.15);
}
.bildbox2:hover .bild2,
.bildbox2:focus .bild2 {
-webkit-transform: scale(1.15);
-ms-transform: scale(1.15);
transform: scale(1.15);
}
.bildbox3:hover .bild3,
.bildbox3:focus .bild3 {
-webkit-transform: scale(1.15);
-ms-transform: scale(1.15);
transform: scale(1.15);
}
.bildbox4:hover .bild4,
.bildbox4:focus .bild4 {
-webkit-transform: scale(1.15);
-ms-transform: scale(1.15);
transform: scale(1.15);
}
.bildbox5:hover .bild5,
.bildbox5:focus .bild5 {
-webkit-transform: scale(1.15);
-ms-transform: scale(1.15);
transform: scale(1.15);
}
.bildbox1:hover .title1,
.bildbox2:hover .title2,
.bildbox3:hover .title3,
.bildbox4:hover .title4,
.bildbox5:hover .title5 {
color: #ffffff !important;
font-family: sans-serif;
text-align: center;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
height: 50px;
opacity: 1.0;
color: white;
padding: 25%;
}
.point1,
.point2,
.point3,
.point4,
.point5 {
width: 0px;
display: initial;
top: 17%;
}
.title1,
.title2,
.title3,
.title4,
.title5 {
opacity: 0.0;
position: absolute;
-webkit-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
top: 0;
}
.konfigurieren-button1,
.konfigurieren-button2,
.konfigurieren-button3,
.konfigurieren-button4,
.konfigurieren-button5 {
opacity: 0.0;
-webkit-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
margin-top: 135px;
}
.bildbox1:hover .konfigurieren-button1,
.bildbox2:hover .konfigurieren-button2,
.bildbox3:hover .konfigurieren-button3,
.bildbox4:hover .konfigurieren-button4,
.bildbox5:hover .konfigurieren-button5 {
opacity: 1.0;
}
.bildbox1:hover .point1,
.bildbox2:hover .point2,
.bildbox3:hover .point3,
.bildbox4:hover .point4,
.bildbox5:hover .point5 {
width: 75px;
}
}
#media (min-width: 900px) {
.bildbox1,
.bildbox2,
.bildbox3,
.bildbox4,
.bildbox5,
.bildbox6 {
width: 400px;
}
}
<div id="flex-container">
<div class="bildbox1">
<div class="bild1">
<span class="title1"> Text 1</span>
<a href="">
<button class="konfigurieren-button1"> Button 1</button>
</a>
<div class="point1"></div>
</div>
</div>
<div class="bildbox2">
<div class="bild2">
<span class="title2"> Text 2</span>
<button class="konfigurieren-button2">Button 2</button>
<div class="point2"></div>
</div>
</div>
<div class="bildbox3">
<div class="bild3">
<span class="title3">Text 3</span>
<button class="konfigurieren-button3">Button 3</button>
<div class="point3"></div>
</div>
</div>
<div class="bildbox4">
<div class="bild4">
<span class="title4"> Text 4</span>
<button class="konfigurieren-button4">Button 4</button>
<div class="point4"></div>
</div>
</div>
<div class="bildbox5">
<div class="bild5">
<span class="title5"> Text 5</span>
<button class="konfigurieren-button5">Button 5</button>
<div class="point5"></div>
</div>
</div>
<div class="bildbox6">
<div class="textbox">
<h3> header </h3>
<p> paragraph
</p>
</div>
</div>
</div>
Add position: relative; to you .bildbox classes.
.bildbox1,
.bildbox2,
.bildbox3,
.bildbox4,
.bildbox5,
.bildbox6 {
width: 100vw;
margin-left: calc(50% - 50vw);
height: 300px;
overflow: hidden;
text-align: center;
position: relative; /* <-- Add this here */
}
You have position: absolute; elements (your .point classes) that are all over the place. They need to be contained in the "boxes". When you are hovering, those position absolute elements are outside the box and overlapping other boxes.
Remember when using position absolute, that element with position itself of the first parent with a position other than static, else it will be the document window.
On a side note, is there a reason you are using classes like ids? Why do you have .bildbox1, .bildbox2, etc when you should just have 1 .bildbox class.
Related
I'm having an issue with an animation on one of my images. I want the image to resize on hover with a transition time (and then have a transition time back to the original size when the mouse moves off the image) but then when i resize the window and the image resizes accordingly, it resizes with the transition time . Does anyone know a way to get around this?
<div class="column">
<a href="-----.html">
<img src="-----.jpg">
</a>
</div>
.column img{
filter: brightness(0.8);
transition: 0.6s ease;
width:100%;
height: calc(100vh - 300px);
}
.column:hover img{
filter: brightness(0.5);
width:110%;
transform: translate(-5%,-5%);
transition: 0.6s ease;
height: calc(110vh - 300px);
}
I can see why the transition applies to the image when the window resizes, but i don't know how else to get the transition to apply when the mouse moves away. Can anyone suggest a way around this?
Gif of resizing issue
edit: full code posted below
html {
height: 100%;
}
body {
min-width: 600px;
min-height: 100%;
position: relative;
font-family: Helvetica;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: #FFFFFF;
overflow-y: hidden;
}
/*Header*/
header {
background: #FFFFFF;
color: #F89828;
height: 159px;
}
header img {
margin-left: calc(50% - 122px);
margin-top: 60px;
margin-bottom: 60px;
height: 39px;
width: 244px;
}
.column {
float: left;
position: relative;
text-align: center;
width: 50%;
padding: 0px;
overflow: hidden;
height: calc(100vh - 239px);
}
.row .column img {
background: #000000;
width: 100%;
filter: brightness(0.8);
height: calc(100vh - 239px);
transition: 0.6s ease;
}
.row .column:hover img {
transition: 0.6s ease;
width: 110%;
cursor: pointer;
transform: translate(-5%, -5%);
filter: brightness(0.5);
height: calc(110vh - 239px);
}
.centered {
color: #FFFFFF;
position: absolute;
font-size: 4em;
font-weight: bold;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-decoration: none;
}
/*footer*/
footer {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0;
width: 100%;
height: 80px;
color: #FFFFFF;
background-color: #808080;
font-weight: bold;
}
<body>
<header>
<img src="https://picsum.photos/400/100/?random">
</header>
<div class="row">
<div class="column">
<a href="---.html">
<img src="https://picsum.photos/300/100/?random">
<div class="centered">1</div>
</a>
</div>
<div class="column">
<a href="---.html">
<img src="https://picsum.photos/300/100/?random" />
<div class="centered">2</div>
</a>
</div>
</div>
<footer>
<p>This is where I would put some filler text, if I had any</p>
</footer>
</body>
You could set the transition on your image only when the window is hovered. This way, on resize it won't affect your element anymore, but on your element's hover and mouseout it will still be active.
/* when hovering the page */
:hover .row .column img {
transition: 0.6s ease;
}
.row .column img {
background: #000000;
width: 100%;
filter: brightness(0.8);
height: calc(80vh - 10px);
/* transition: 0.6s ease; [removed]*/
}
.row .column:hover img {
/* transition: 0.6s ease; [useless]*/
width: 110%;
cursor: pointer;
transform: translate(-5%, -5%);
filter: brightness(0.5);
height: calc(80vh - 10px);
}
.column {
float: left;
position: relative;
text-align: center;
width: 50%;
padding: 0px;
overflow: hidden;
height: calc(60vh - 10px);
}
<div class="row">
<div class="column">
<a href="---.html">
<img src="https://picsum.photos/300/100/?random">
<div class="centered">1</div>
</a>
</div>
<div class="column">
<a href="---.html">
<img src="https://picsum.photos/300/100/?random" />
<div class="centered">2</div>
</a>
</div>
</div>
But using this solution, if mousing-out from the document itself, then the transition will also get disabled...
Unfortunately, I don't see any other solution than that, except using js of course.
(function(){
let timer;
const docEl = document.documentElement;
addEventListener('resize', e => {
clearTimeout(timer);
docEl.classList.add('resizing');
timer = setTimeout(_ => docEl.classList.remove('resizing'), 200);
});
})();
:root.resizing .row .column img {
transition: none;
}
.row .column img {
background: #000000;
width: 100%;
filter: brightness(0.8);
height: calc(80vh - 10px);
transition: 0.6s ease;
}
.row .column:hover img {
width: 110%;
cursor: pointer;
transform: translate(-5%, -5%);
filter: brightness(0.5);
height: calc(80vh - 10px);
}
.column {
float: left;
position: relative;
text-align: center;
width: 50%;
padding: 0px;
overflow: hidden;
height: calc(60vh - 10px);
}
<div class="row">
<div class="column">
<a href="---.html">
<img src="https://picsum.photos/300/100/?random">
<div class="centered">1</div>
</a>
</div>
<div class="column">
<a href="---.html">
<img src="https://picsum.photos/300/100/?random" />
<div class="centered">2</div>
</a>
</div>
</div>
You need to assign width without hover for animation on mouse out, check it
.column img{
filter: brightness(0.8);
transition: 0.6s ease;
width:35%;
}
.column:hover img{
filter: brightness(0.5);
width:110%;
transform: translate(-5%,-5%);
transition: 0.6s ease;
}
<div class="column">
<a href="-----.html">
<img src="https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
</a>
</div>
Try this:
.container {
display: inline-block;
width: 64px;
height: 64px;
perspective: 700px;
}
.icon, .icon-one, .icon-two{
position: absolute;
transition: all .5s;
transform-style: preserve-3d;
backface-visibility: hidden;
width:50px;
height:50px;
}
}
.icon-wrap .icon-one{
width:150px;
height:150px;
transform:translate(0%,0%);}
/* ::: HOVER EFFECTS (Remove Automated for this to work) */
.icon-wrap:hover .icon{ transform: translate(0%,0%); }
/* ::: AUTOMATED EFFECTS */
.icon-wrap .icon{
animation: icon-wrap 5s 1s infinite alternate ease-in-out;
-webkit-animation: icon-wrap 5s 1s infinite alternate ease-in-out;
}
#keyframes icon-wrap {
0% { transform:translate(0%,0%); }
100% { transform: translate(40%,40%)scale(2);
width:150px;
height:150px;
}
}
#-webkit-keyframes icon-wrap {
0% { transform: translate(0%,0%); }
100% { transform: translate(40%,40%) scale(2);
width:150px;
height:150px; }
}
<div class="container icon-wrap">
<div class="icon">
<div class="icon-one">
<a href="-----.html">
<img src="https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
</a>
</div>
</div>
</div>
.container {
display: inline-block;
width: 64px;
height: 64px;
perspective: 700px;
}
.icon, .icon-one, .icon-two{
position: absolute;
transition: all .5s;
transform-style: preserve-3d;
backface-visibility: hidden;
width:50px;
height:50px;
}
}
.icon-wrap .icon-one{
width:150px;
height:150px;
transform:translate(40%,40%)scale(2);}
/* ::: HOVER EFFECTS (Remove Automated for this to work) */
.icon-wrap:hover .icon{ transform: translate(40%,40%)scale(2); }
/* ::: AUTOMATED EFFECTS */
.icon-wrap .icon{
animation: icon-wrap 5s 1s infinite alternate ease-in-out;
-webkit-animation: icon-wrap 5s 1s infinite alternate ease-in-out;
}
<div class="container icon-wrap">
<div class="icon">
<div class="icon-one">
<a href="-----.html">
<img src="https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
</a>
</div>
</div>
</div>
Try using scale(2) it's working well for me.
But you need to change translate() value as per the scale() value as per your requirement.
.column img{
filter: brightness(0.8);
transition: 0.6s ease;
}
.column:hover img{
filter: brightness(0.5);
transform: translate(50%,50%) scale(2);
transition: 0.6s ease;
}
<div class="column">
<a href="-----.html">
<img src="https://picsum.photos/300/100/?random">
</a>
</div>
Updated with your code.
html {
height: 100%;
}
body {
min-width: 600px;
min-height: 100%;
position: relative;
font-family: Helvetica;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: #FFFFFF;
overflow-y: hidden;
}
/*Header*/
header {
background: #FFFFFF;
color: #F89828;
height: 159px;
}
header img {
margin-left: calc(50% - 122px);
margin-top: 60px;
margin-bottom: 60px;
height: 39px;
width: 244px;
}
.column {
float: left;
position: relative;
text-align: center;
width: 50%;
padding: 0px;
overflow: hidden;
height: calc(100vh - 239px);
}
.row .column img {
background: #000000;
width: 100%;
filter: brightness(0.8);
height: calc(100vh - 239px);
transition: 0.6s ease;
}
.row .column:hover img {
transition: 0.6s ease;
width: 110%;
cursor: pointer;
transform: translate(-10%,-10%) scale(1.3);
filter: brightness(0.5);
height: calc(110vh - 239px);
}
.centered {
color: #FFFFFF;
position: absolute;
font-size: 4em;
font-weight: bold;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-decoration: none;
}
/*footer*/
footer {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 0;
width: 100%;
height: 80px;
color: #FFFFFF;
background-color: #808080;
font-weight: bold;
}
<body>
<header>
<img src="https://picsum.photos/400/100/?random">
</header>
<div class="row">
<div class="column">
<a href="---.html">
<img src="https://picsum.photos/300/100/?random">
<div class="centered">1</div>
</a>
</div>
<div class="column">
<a href="---.html">
<img src="https://picsum.photos/300/100/?random" />
<div class="centered">2</div>
</a>
</div>
</div>
<footer>
<p>This is where I would put some filler text, if I had any</p>
</footer>
</body>
Hope this was helpful for you.
I want to reproduce buttons like those
so I found this code
#import "https://fonts.googleapis.com/css?
family=Didact+Gothic&subset=greek";
#import "https://cdn.linearicons.com/free/1.0.0/icon-font.min.css";
body {
font-family: 'Didact Gothic', sans-serif;
letter-spacing: 1px;
font-weight: bold;
}
.side-menu {
display: flex;
flex-wrap: wrap;
max-width: 300px;
position: fixed;
right: 0;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.side-menu > * + * {
margin-top: 0.5em;
}
.btn {
display: flex;
color: #fff;
flex: 100%;
transition: -webkit-transform 0.2s ease-out;
transition: transform 0.2s ease-out;
transition: transform 0.2s ease-out, -webkit-transform 0.2s ease-out;
-webkit-transform: translateX(236px);
transform: translateX(236px);
text-decoration: none;
}
.btn:hover {
-webkit-transform: translateX(0px);
transform: translateX(0px);
}
.btn__icon {
flex: 0 0 32px;
padding: 1rem;
font-size: 2em;
background-color: #ff6347;
}
.btn__text {
flex: 0 0 100%;
display: flex;
align-items: center;
padding: 1rem;
background-color: #ff927e;
}
that creates the same buttons.Only problem is that when I try to recreate them to my CSS header file,I get the correct functionality but not the position and the layout (color etc).I copy the first part to the and I call it on header by the second command.
<a href="#" class="btn" > <button> register </button></a>
probably it’s something dummy I ‘m messing but I ‘m only now starting with CSS..
I cant understand the problem exactly and I haven't implement all your styles but this is the main idea
<div class="button-wrapper">
<div>Button</div>
<div>Button</div>
<div>Button</div>
</div>
.button-wrapper {
position: fixed;
right: 0;
top: 50%;
transform: translateY(-50%)
}
.button-wrapper > div {
background : orange;
padding: .4rem;
margin-bottom: 5px;
transform: translateX(50%);
transition: transform 0.2s ease-out;
}
.button-wrapper > div:hover {
transform: translate(0%)
}
I've created a Slanted Div, however I ran into problem I cannot solve, I've googled this but did not find any answers.
body {
background: black;
}
#slantedwrapper {
overflow: hidden;
margin-left: 50px;
}
#slanted {
display: inline-block;
/* margin-right:-4px; */
width: 400px;
margin-left: -45px;
/* background-image: url("http://www.keenthemes.com/preview/conquer/assets/plugins/jcrop/demos/demo_files/image2.jpg"); */
}
#slanted a {
position: relative;
background-color: #1d1d1d;
/* background-image: url("http://www.keenthemes.com/preview/conquer/assets/plugins/jcrop/demos/demo_files/image2.jpg"); */
box-sizing: border-box;
background-size: cover;
/* padding:1em; */
display: block;
transform: skewX(-30deg);
width: 100%;
min-height: 3.5em;
text-align: center;
border-right: 5px solid #20c397;
height: 150px;
/* line-height: 110px; */
overflow: hidden;
}
#slanted span {
color: white;
position: absolute;
box-sizing: border-box;
transform: skewX(30deg);
left: 0;
width: 100%;
/* height: 150px; */
/* background-image: url("http://www.keenthemes.com/preview/conquer/assets/plugins/jcrop/demos/demo_files/image2.jpg"); */
}
}
}
.current a {
background:#70cb00;
}
#slanted a img {
transform: skewX(30deg);
overflow: hidden;
margin-top: -20px;
padding-top: 0px;
width: 123%;
height: 123%;
margin-left: -50px;
opacity: 0.6;
-webkit-transition: opacity 0.3s linear 0s;
-o-transition: opacity 0.3s linear 0s;
transition: opacity 0.3s linear 0s;
}
#slanted img:hover {
opacity:1;
}
#caption {
background-color: #333333;
width: 100%;
height: 25px;
display: block;
position: absolute;
bottom: 0;
z-index: 99;
opacity: 0.7;
color: #D2D2D2;
-webkit-transition: background-color 0.3s linear 0s;
-o-transition: background-color 0.3s linear 0s;
transition: background-color 0.3s linear 0s;
}
/*Combination hover effects*/
#slanted:hover #caption {
background-color: #20c397;
opacity:1.0;
}
#slanted:hover img {
opacity:1.0;
}
/* END OFCombo hover effects*/
p.nonskew {
transform: skewX(30deg);
color: White;
margin: 0;
margin-left: 22%;
padding: 1.5%;
text-align: left;
font-size: 0.8em;
}
<div id="slantedwrapper">
<div id="slanted">
<a href="#">
<div id="caption">
<p class="nonskew">A Caption: Description</p>
</div>
<img src="http://www.keenthemes.com/preview/conquer/assets/plugins/jcrop/demos/demo_files/image2.jpg" alt="SLANTED DIV"></a>
</div>
<!--end of wrapper-->
</div>
JSFiddle version
here's the problem:
Hover over the div, it hovers fine, but at the bottom right corner, where nothing is there (where the overflow is hidden) still hovers if you place your mouse over the blank area where the angle begins, how do I solve this into when it hovers- it only applies to shape of the div only?
Thank you
You seem to have the right idea, using both the unskew and intuitive to using the skew, however, something like the below example may work for you:
html {
background: radial-gradient(#222, blue);
height: 100%;
}
div.wrap{
height: 150px;
width: 300px; position: relative;
overflow: hidden;
}
div.innerwrap {
height: 100%;
width: 100%;
transform: skewX(-30deg);
position: absolute;top:0;left:0;
overflow: hidden;
margin-left: -70px;
transition: all 0.4s;
border-right: 5px solid tomato;
cursor:pointer;
}
div.innerwrap:hover span {
background: gold;
}
div.innerwrap:before {
content: "";
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
background: url(http://lorempixel.com/300/300);
transform: skewX(30deg);
transform-origin: top left;
}
div span {
position: absolute;
bottom: 0;
left: 0%;
width: 120%;
transform: skewX(30deg);
background: red;
text-align:center;
transition: all 0.4s;
}
<div class="wrap">
<div class="innerwrap">
<span>TITLE</span>
</div>
</div>
For further information, #Harry has created a wide variety of examples here in which you may find useful.
jsfiddle: https://jsfiddle.net/e0u4sow1/
I want to use the following code for an image to link to another page. Right now if I make it a link it doesn't work. I read somewhere I need to add
pointer-events: none;
somewhere in the code. It tried, but it either doesn't work or it works but removes the overlay.
HTML:
<h1>MR Cube</h1>
<div class="media"></div>
<div class="media"><img alt="" class="media__image" src="http://www.webwinkelsucces.nl/wp-content/uploads/2015/05/1112625-les-outils-de-test-et-d-integration-continue-open-source.jpg" />
<div class="media__body">
<h1>Lees meer</h1>
</div>
</div>
CSS:
.media {
display: inline-block;
position: relative;
vertical-align: top;
}
.media__image { display: block; }
.media__body {
background: rgba(41, 128, 185, 0.7);
bottom: 0;
color: white;
font-size: 1em;
left: 0;
opacity: 0;
overflow: hidden;
padding: 3.75em 3em;
position: absolute;
text-align: center;
top: 0;
right: 0;
-webkit-transition: 0.6s;
transition: 0.6s;
}
.media__body:hover { opacity: 1; }
.media__body:after,
.media__body:before {
border: 1px solid rgba(255, 255, 255, 0.7);
bottom: 1em;
content: '';
left: 1em;
opacity: 0;
position: absolute;
right: 1em;
top: 1em;
-webkit-transform: scale(1.5);
-ms-transform: scale(1.5);
transform: scale(1.5);
-webkit-transition: 0.6s 0.2s;
transition: 0.6s 0.2s;
}
.media__body:before {
border-bottom: none;
border-top: none;
left: 2em;
right: 2em;
}
.media__body:after {
border-left: none;
border-right: none;
bottom: 2em;
top: 2em;
}
.media__body:hover:after,
.media__body:hover:before {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
opacity: 1;
}
.media__body h2 { margin-top: 0; }
.media__body p { margin-bottom: 1.5em; }
move .media__body inside a
<a href="http://www.google.nl/">
<img alt="" class="media__image" src="http://www.webwinkelsucces.nl/wp-content/uploads/2015/05/1112625-les-outils-de-test-et-d-integration-continue-open-source.jpg" />
<div class="media__body">
<h1>Lees meer</h1>
</div>
</a>
check this fiddle
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.image-container{
width:200px;
position:relative;
overflow: hidden;
}
.image-container img {
max-width: 100%;
height: auto;
display: block; /* added this */
}
.image-container a {
position:absolute;
color: #fff;
width: 100%;
height: 100%;
top: 0;
left: 0;
padding: 0;
z-index:2;
}
.image-container .image-overlay{
opacity:0;
position:absolute;
color: #fff;
background: rgba(141, 178, 215, 0.77);
width: 100%;
height: 100%;
top: 0;
left: 0;
padding: 0;
text-align:center;
font-size:40px;
line-height: 200px; /* added this */
-webkit-transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-ms-transition: opacity .5s ease-in-out;
-o-transition: opacity .5s ease-in-out;
transition: opacity .5s ease-in-out;
z-index:1;
}
.image-container:hover .image-overlay{
opacity:1;
}
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<div class="image-container">
<div class="image-overlay">
<i class="fa fa-search"></i>
</div>
<img src="https://placehold.it/350x350">
</div>
Although JQuery has not been tagged, this is what you could have done using it:
$(".media__body").click(function(){
window.location = "http://www.google.com/";
});
Here is a Demo
Here is the solution, just wrap all tags used for image with <a> tag
Demo
<h1>MR Cube</h1>
<a href="www.google.com" >
<div class="media"></div>
<div class="media"><img alt="" class="media__image" src="http://www.webwinkelsucces.nl/wp-content/uploads/2015/05/1112625-les-outils-de-test-et-d-integration-continue-open-source.jpg" />
<div class="media__body">
<h1>Lees meer</h1>
</div>
</div>
</a>
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/