Note: The answers below are for the previous question regarding transition which I've edited for now.
I've got a blog-row with two columns. Each column has an inner which consists of an image on top and content related to the blog. I've taken an overlay pseudo-element for the image so when you hover on the inner the overlay should be applied on to the image with the transition. Everything works fine except the when you hover over the image you can see about 7px of space at the bottom of the image, to cover that I need to apply as margin-bottom: -7px. This is the problem with all the images on my page.
.row {
position: relative;
width: 100%;
margin-bottom: 40px;
}
.blog-item-inner {
background-color: #fbfbfb;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
}
.blog-img-inner {
position: relative;
overflow: hidden;
text-align: center;
transition: all 0.4s ease-in-out;
}
img {
height: auto;
max-width: 100%;
margin-bottom: -7px;
}
.blog-post-date {
position: absolute;
top: 35px;
left: 35px;
border: 2px solid #ffffff;
text-align: center;
width: 40px;
height: 35px;
z-index: 999;
}
.blog-post-date p {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #ffffff;
line-height: 1;
margin-top: 0px;
padding: 5px 10px;
}
.blog-post-date span {
font-family: 'Open Sans', sans-serif;
font-size: 8px;
color: #ffffff;
line-height: 1;
font-weight: 400;
margin-bottom: 0;
display: block;
margin-top: 3px;
}
.blog-title-excerpt {
padding: 40px 40px 30px;
}
.blog-title-excerpt h3 {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #000000;
margin-top: 0;
margin-bottom: 15px;
}
.blog-title-excerpt p {
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 400;
color: #888888;
margin-bottom: 0;
}
.blog-image {
position: relative;
margin-bottom: 24px;
transition: box-shadow 0.3s linear;
}
.blog-img-inner:before {
content: " ";
z-index: 10;
opacity: 0;
position: absolute;
height: 100%;
top: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
transition: all 0.3s ease-in-out;
}
.blog-item-inner:hover .blog-img-inner:before {
opacity: 1;
}
.blog-image .post-meta {
position: absolute;
right: 12px;
bottom: 12px;
display: block;
z-index: 15;
}
.blog-content a {
color: #222222;
text-decoration: none;
font-family: "Droid Serif", sans-serif;
}
.post-meta {
display: block;
margin-top: 10px;
cursor: pointer;
}
.post-meta span {
margin-right: 10px;
font-size: 12px;
color: #c0c0c0;
transition: all 0.3s ease-in-out;
}
.post-meta span:hover {
color: #777777;
}
.col6 {
width: 47.96%;
}
.col {
display: inline-block;
float: left;
margin-right: 4%;
}
.col:last-child {
margin-right: 0;
}
<div class="row clearfix">
<div class="col col6 blog-items">
<div class="blog-item-inner clearfix">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>18 <span>DEC</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a pulse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 183</span>
<span><i class="fa fa-comment-o"></i> 57</span>
</div>
</div>
</div>
</div>
<div class="col col6 blog-items">
<div class="blog-item-inner">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog6 Image">
<div class="blog-post-date">
<p>12 <span>JUN</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a puIse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 120</span>
<span><i class="fa fa-comment-o"></i> 18</span>
</div>
</div>
</div>
</div>
</div>
The problem is that you forgot the "s" after 0.3 in your code.
transition: all 0.3s ease-in-out;
.row {
position: relative;
width: 100%;
margin-bottom: 40px;
}
.blog-item-inner {
background-color: #fbfbfb;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
}
.blog-img-inner {
position: relative;
overflow: hidden;
text-align: center;
transition: all 0.4s ease-in-out;
}
.blog-post-date {
position: absolute;
top: 35px;
left: 35px;
border: 2px solid #ffffff;
text-align: center;
width: 40px;
height: 35px;
z-index: 999;
}
.blog-post-date p {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #ffffff;
line-height: 1;
margin-top: 0px;
padding: 5px 10px;
}
.blog-post-date span {
font-family: 'Open Sans', sans-serif;
font-size: 8px;
color: #ffffff;
line-height: 1;
font-weight: 400;
margin-bottom: 0;
display: block;
margin-top: 3px;
}
.blog-title-excerpt {
padding: 40px 40px 30px;
}
.blog-title-excerpt h3 {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #000000;
margin-top: 0;
margin-bottom: 15px;
}
.blog-title-excerpt p {
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 400;
color: #888888;
margin-bottom: 0;
}
.blog-image {
position: relative;
margin-bottom: 24px;
transition: box-shadow 0.3s linear;
}
.blog-img-inner:before {
content: " ";
z-index: 10;
opacity: 0;
position: absolute;
height: 100%;
top: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
transition: all 0.3s ease-in-out;
}
.blog-item-inner:hover .blog-img-inner:before {
opacity: 1;
}
.blog-image .post-meta {
position: absolute;
right: 12px;
bottom: 12px;
display: block;
z-index: 15;
}
.blog-content a {
color: #222222;
text-decoration: none;
font-family: "Droid Serif", sans-serif;
}
.post-meta {
display: block;
margin-top: 10px;
cursor: pointer;
}
.post-meta span {
margin-right: 10px;
font-size: 12px;
color: #c0c0c0;
transition: all 0.3s ease-in-out;
}
.post-meta span:hover {
color: #777777;
}
.col6 {
width: 47.96%;
}
.col {
display: inline-block;
float: left;
margin-right: 4%;
}
.col:last-child {
margin-right: 0;
}
<div class="row clearfix">
<div class="col col6 blog-items">
<div class="blog-item-inner clearfix">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>18 <span>DEC</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a pulse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 183</span>
<span><i class="fa fa-comment-o"></i> 57</span>
</div>
</div>
</div>
</div>
<div class="col col6 blog-items">
<div class="blog-item-inner">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog6 Image">
<div class="blog-post-date">
<p>12 <span>JUN</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a puIse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 120</span>
<span><i class="fa fa-comment-o"></i> 18</span>
</div>
</div>
</div>
</div>
</div>
Use simple transition: 0.4s ease;
.row {
position: relative;
width: 100%;
margin-bottom: 40px;
}
.blog-item-inner {
background-color: #fbfbfb;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
}
.blog-img-inner {
position: relative;
overflow: hidden;
text-align: center;
transition: all 0.4s ease-in-out;
}
.blog-post-date {
position: absolute;
top: 35px;
left: 35px;
border: 2px solid #ffffff;
text-align: center;
width: 40px;
height: 35px;
z-index: 999;
}
.blog-post-date p {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #ffffff;
line-height: 1;
margin-top: 0px;
padding: 5px 10px;
}
.blog-post-date span {
font-family: 'Open Sans', sans-serif;
font-size: 8px;
color: #ffffff;
line-height: 1;
font-weight: 400;
margin-bottom: 0;
display: block;
margin-top: 3px;
}
.blog-title-excerpt {
padding: 40px 40px 30px;
}
.blog-title-excerpt h3 {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #000000;
margin-top: 0;
margin-bottom: 15px;
}
.blog-title-excerpt p {
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 400;
color: #888888;
margin-bottom: 0;
}
.blog-image {
position: relative;
margin-bottom: 24px;
transition: box-shadow 0.3s linear;
}
.blog-img-inner:before {
content: " ";
z-index: 10;
opacity: 0;
position: absolute;
height: 100%;
top: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
transition: 0.4s ease;
-webkit-transition: 0.4s ease;
-moz-transition: 0.4s ease;
-o-transition: 0.4s ease;
}
.blog-item-inner:hover .blog-img-inner:before {
opacity: 1;
}
.blog-image .post-meta {
position: absolute;
right: 12px;
bottom: 12px;
display: block;
z-index: 15;
}
.blog-content a {
color: #222222;
text-decoration: none;
font-family: "Droid Serif", sans-serif;
}
.post-meta {
display: block;
margin-top: 10px;
cursor: pointer;
}
.post-meta span {
margin-right: 10px;
font-size: 12px;
color: #c0c0c0;
transition: all 0.3s ease-in-out;
}
.post-meta span:hover {
color: #777777;
}
.col6 {
width: 47.96%;
}
.col {
display: inline-block;
float: left;
margin-right: 4%;
}
.col:last-child {
margin-right: 0;
}
<div class="row clearfix">
<div class="col col6 blog-items">
<div class="blog-item-inner clearfix">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>18 <span>DEC</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a pulse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 183</span>
<span><i class="fa fa-comment-o"></i> 57</span>
</div>
</div>
</div>
</div>
<div class="col col6 blog-items">
<div class="blog-item-inner">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog6 Image">
<div class="blog-post-date">
<p>12 <span>JUN</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a puIse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 120</span>
<span><i class="fa fa-comment-o"></i> 18</span>
</div>
</div>
</div>
</div>
</div>
Related
body {
font-family: Bahnschrift SemiBold, sans-serif;
background-color: #fcfefe;
width: 100%;
height: 100%;
overflow-x: hidden;
}
*{
margin:0; padding: 0;
}
.logonav{
position: top;
left: 0px;
width: 250px;
height: 65px;
padding-top: 70px;
padding-bottom: 20px;
padding-left: 40px;
}
.content{
position: absolute;
bottom: 330px;
left: 30px;
text-align: justify;
font-size: 20px;
font-family: 'Titillium Web', sans-serif;
color: #ffffff;
}
.bn632-hover {
position: absolute;
bottom: 200px;
left: 1200px;
width: 160px;
font-size: 16px;
font-weight: 600;
color: #00bbf0;
cursor: pointer;
margin: 20px;
height: 55px;
text-align:center;
color: whitesmoke;
border: none;
background-size: 300% 100%;
border-radius: 50px;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.bn632-hover:hover {
background-position: 100% 0;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.bn632-hover:focus {
outline: none;
}
.bn632-hover.bn18 {
background-image: linear-gradient(
to right,
#25aae1,
#00bbf0,
#00bbf0,
#00bbf0
);
box-shadow: 0 4px 15px 0 rgba(49, 196, 190, 0.75);
}
.image_container.img{
max-height: 100vh;
max-width: 100%;
object-fit: cover;
object-position: bottom;
}
.pozadina{
background-color: #83a3c7;
background-image: url("womandoctor.jpg");
background-size: cover;
width: 110%;
background-blend-mode: normal;
position: relative;
padding-top: 450px;
padding-bottom: 100px;
}
.hornav1{
overflow: hidden;
width: 100%;
background-color: #00bbf0;
list-style-type: none;
margin: 0px;
padding: 0px;
border-bottom: solid 2px #eaf6f6;
size: 100px;
position:fixed;
top:0;
z-index:100;
}
.hornav1 a{
float: right;
color: whitesmoke;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
box-sizing: border-box;
margin-left: 5px 10 px;
}
.hornav1 i{
color: whitesmoke;
}
#pocetna{
padding-right: 1000px;
font-size: 20px;
}
.hornav2{
overflow: hidden;
width: 100%;
background-color: #ffffff;
list-style-type: none;
margin: 0px;
padding: 0px;
position: sticky;
top: 0px;
border-bottom: solid 2px #eaf6f6;
}
.hornav2 a{
float: right;
color: #333;
text-align: center;
padding: 14px 16px;
font-size: 17px;
box-sizing: border-box;
margin-left: 5px 10 px;
}
.hornav3{
overflow: hidden;
width: 100%;
background-color: #00bbf0;
list-style-type: none;
margin: 0px;
padding: 10px;
position:sticky;
border-bottom: solid 2px #eaf6f6;
size: 150px;
}
.hornav3 a{
position: relative;
color: whitesmoke;
text-align: center;
padding-left: 50px;
text-decoration: none;
font-size: 24px;
box-sizing: border-box;
right : -270px;
}
.navcontainer{
top:0;
width:100%;
z-index:100;
}
.hornav3 a::before{
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 2px;
background-color: whitesmoke;
transition: width 0.6s cubic-bezier(0.5, 1, 0.5, 1);
}
#media (hover: hover) and (pointer: fine) {
.hornav3 a:hover::before{
left: 0.5;
right: auto;
width: 70%;
}
}
.pregledi{
background-color: #fafafa;
}
.pregledi .heading{
padding-top: 40px;
text-transform: uppercase;
color: deepskyblue;
text-align: center;
font-size: 35px;
}
.pregledi .heading2{
padding-top: 5px;
text-align: center;
font-size: 20px;
font-family: unset;
color: #2c5d63;
}
.pregledi .box-container{
padding-top: 30px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(20rem, 7fr));
gap:4rem;
margin-left: 60px;
margin-right: 30px;
}
.pregledi .box-container .box h3{
padding-top: 10px;
color: deepskyblue;
text-transform: uppercase;
font-size: 2.1rem;
}
.pregledi .box-container .box p{
padding-top: 10px;
font-family: sans-serif;
font-size: 1rem;
line-height: 1;
}
.pregledi .box-container .box a{
position: relative;
top: 10px;
}
.bn111 {
margin-top: 10px;
padding: 1.3em 0.01em;
font-size: 12px;
text-transform: uppercase;
text-indent: 10px;
letter-spacing: 2.5px;
font-weight: 500;
color: #ffffff;
background-color: #00bbf0;
border: none;
border-radius: 45px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
transition: all 0.24s ease 0s;
cursor: pointer;
outline: none;
}
.bn111:hover {
background-color: #00bbf0;
box-shadow: 0px 15px 20px rgba(34, 180, 255, 0.4);
color: #ffffff;
transform: translateX(7px) translateY(-1.1px);
}
.bn111:active {
transform: translateY(-1px);
}
.bn111 i{
color: #ffffff;
font-size: 1.3em;
padding-right: 4px;
}
.izborna{
background-color: #83a3c7;
background-size: cover;
width: 100%;
background-blend-mode: normal;
opacity: 1;
display: block;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
}
.containerslike{
position: relative;
width: 100%;
max-width: 400px;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .3s ease;
background-color: #ececec;
}
.containerslike:hover .overlay {
opacity: 0.5;
}
.ikona {
color: deepskyblue;
font-size: 40px;
position: absolute;
top: 100%;
left: 45%;;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
opacity: 1;
}
.fa-magnifying-glass{
position: absolute;
top: 100px;
}
.bn112 {
margin-top: 10px;
padding: 1.3em 0.01em;
font-size: 18px;
text-transform: uppercase;
text-indent: 10px;
letter-spacing: 2.5px;
font-weight: 500;
color: #ffffff;
background-color: #00bbf0;
border: none;
border-radius: 45px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
transition: all 0.24s ease 0s;
cursor: pointer;
outline: none;
width: 400px;
}
.bn112:hover {
background-color: #00bbf0;
box-shadow: 0px 15px 20px rgba(34, 180, 255, 0.4);
color: #ffffff;
transform: translateY(-1.1px);
}
.bn112:active {
transform: translateY(-1px);
}
.bn112 i{
color: #ffffff;
font-size: 1.3em;
padding-right: 4px;
}
.podnopregled{
margin-left: 500px;
}
.infodiv{
margin-top: 30px;
background-color: deepskyblue;
}
.row {
display: flex;
width: 100%;
}
.noMargin {
margin: 1px;
}
.one {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 30px;
}
.two {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 30px;
}
.three {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 10px;
}
.four {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 10px;
}
.noMargin p{
text-align: center;
margin-top: 100px;
}
#media only screen and (max-width:800px) {
/* For tablets: */
.main {
width: 80%;
padding: 0;
}
.right {
width: 100%;
}
}
#media only screen and (max-width:500px) {
/* For mobile phones: */
.menu, .main, .right {
width: 100%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>VivaMed medicina rada i sporta</title>
<script src="https://kit.fontawesome.com/60681a69ff.js" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="VivamedCSS.css">
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web:wght#300&display=swap" rel="stylesheet">
</head>
<body>
<div class="navcontainer">
<div class="hornav1">
<i class="fas fa-envelope" style="font-size:20px;"></i> info#vivamed.hr
<i class="fa-solid fa-phone"style="font-size:20px;" ></i> +385 1 233 55 00
Početna
</div>
<div class="hornav2">
<img src="vivalogo.webp" alt="logo" class="logonav">
<a class="active" style="font-size: 20px; padding-right: 550px; padding-top: 100px; font-family: 'Titillium Web', sans-serif; font-style: italic; font-weight: bolder;"> Zdrav radnik je uspješan i produktivan radnik.</a>
</div>
<div class="hornav3">
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-envelope" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-cloud" style="font-size:20px; color: whitesmoke;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-comment" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-car" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/galerija"><i class="fas fa-bolt" style="font-size:20px;"></i> O nama</a>
<a class="active" href="file:///C:/Users/Admin/Desktop/Vivamed/VIVAMED%20JEDAN.html#slide-2"><i class="fas fa-envelope"></i> Početna</a>
</div>
</div>
<div class="pozadina">
<div class="content">
<h3>Dobro došli na stranicu Medicine rada i sporta VivaMed!</h3>
<p>Pogledajte sve profesionalne usluge koje nudi
<br>naš tim vrhunskih i renomiranih stručnjaka!
</p>
</div>
<button class="bn632-hover bn18">Naručite se!</button>
</div>
<section class="pregledi" id="pregledi">
<h1 class="heading"> <span> Stručno, brzo i povoljno! </span> </h1>
<h2 class="heading2"> <span>Izdvojeni pregledi</span></h3>
<div class="box-container">
<div class="box">
<div class="containerslike">
<img src="pexels-pixabay-262524.jpg" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Pregled sportaša</h3>
<p>Rekreativci, amateri, profesionalci</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="box">
<div class="containerslike">
<img src="delivery-driver-smiling-camera-his-van_13339-235836.jpg" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Pregled vozača</h3>
<p>Sve vrste kategorija i pregleda</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="box">
<div class="containerslike">
<img src="happy-graduate-woman-mantle-rejoicing-laughing-smiling_176420-14226.webp" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Učenici i studenti</h3>
<p>Upisi u srednje škole, fakultete i druge akadamske ustanove</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="podnopregled">
<button class="bn112" id="bn112"> Svi pregledi<i class="fa-solid fa-arrow-right"></i></button>
</div>
</div>
</section>
<!--
-->
<div class="infodiv">
<div class="row noMargin">
<div class="one">
<p>Radno vrijeme<br>
ponedjeljak 07 - 15
utorak 07 - 18
srijeda 07 - 14
četvrtak 07 - 14
petak 07 - 14
i prema dogovoru </p>
</div>
<div class="two">
<p>Adresa<br>
Krešićeva ul. 32/1. Kat (okretište tramvaja Borongaj)</p>
</div>
</div>
<div class="row noMargin">
<div class="three">
<p>Email<br>
info#vivamed.hr</p>
</div>
<div class="four">
<p>Telefon<br>
+385 1 233 55 00</p>
</div>
</div>
</div>
</body>
</html>
I've been coding a website in html,css and used some javascript scripts to do it. It is a medical website and so far I've done a lot to the main page which is my main problem here. I am self-taught and all the paddings, margins and screen-fits that I've coded into it are were actually applying only to the screen size that is on my laptop, and not others. I've tested this by uploading the files to InfintyFree and making it online just for the sake of testing it on other screens, and what happens is that all the content is scattered around the screen. I've put some pictures to show how it looks in comparison with my laptop, other laptop that I have and my phone. Also I've put the html and css code if you can check it out and see where I screwed up and just point me to the core because I really cannot comprehend what is going on.
Thank in advance, and sorry if there was a question like this before, because I haven't found one.[][]
I have tried putting the *{} and changing properties with it, in the body{}, height, width, overflow, padding, margins, Media only screen, everything. Still, everything fixed but only on my laptop on which it was built.
I have this navigation menu I made with html and scss, however everything works fine, but when I click on the links inside the nav-menu, the navigation menu does not close for the page content to show. It still overlays the content on the page. In a nutshell, I want the navigation menu to close and when a link is clicked.
My HTML code
<input type="checkbox" class="navigation__checkbox" id="navi-toggle">
<label for="navi-toggle" class="navigation__button">
<span class="navigation__icon"> </span>
</label>
<div class="navigation__background"> </div>
<div class="navigation__nav">
<div class="container-fluid" id="hd">
<div class="row">
<div class="col-9 col-md-5 col-lg-5" id="both">
<h6 class="fw-b" id="in-nav">-on the web- </h6>
<div class="social-links fs-5 mb-4 end text-dark">
<i class="bi bi-twitter"></i>
<i class="bi bi-facebook"></i>
<i class="bi bi-github"></i><br>
<i class="bi bi-linkedin"></i>
<i class="bi bi-instagram"></i>
<i class="bi bi-medium"></i>
</div>
<div class="mb-4">
<a class="resume" href="afolabi-resume.pdf" target="_blank" rel="noopener noreferrer">Resume 📙</a>
</div>
</div>
<div class="col-5 col-md-6 col-lg-6">
<div class="list">
<h6 class="fw-b" id="in-nav" style="margin-left:2rem;">-navigation-</h6>
<ul class="ul">
<li class="list-item"><a href="/" id="c" >Home</a></li>
<li class="list-item">Projects</li>
<li class="list-item">Stacks</li>
<li class="list-item">Contact</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div> ```
**SCSS**
.navigation {
overflow-y: hidden;
&__checkbox {
display: none;
}
&__button {
background-color: rgb(0, 0, 0);
height: 4.5rem;
width: 4.5rem;
border-radius: 50%;
position: fixed;
top: 2rem;
right: 6rem;
z-index: 2000;
box-shadow: 0 1rem 3rem rgba(#000, .2);
text-align: center;
cursor: pointer;
}
&__background {
z-index: 500;
background-color: #006274;
background-image: url("download.png");
background-size: 20px;
animation: bg1 150s linear 1s infinite alternate-reverse;
height: 2.8rem;
width: 2.8rem;
border-radius: 50%;
position: fixed;
top: 3.2rem;
right: 6.8rem;
transition: transform .9s cubic-bezier(0.86, 0, 0.07, 1);
}
#keyframes bg1{
0% {background-position: 0 0;}
50% {transform: rotate(300deg 50deg);}
100% {background-position: 170px 0;}
}
&__nav {
height: 100vh;
position: fixed;
top: 6.5rem;
left: 0;
z-index: 1500;
opacity: 0;
width: 0;
transition: all .8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
&__checkbox:checked ~ &__background {
transform: scale(80);
}
&__checkbox:checked ~ &__nav {
opacity: 1;
width: 100%;
}
&__icon {
right: -.2rem;
width: 50rem;
position: relative;
margin-top: 2.3rem;
&{
width: 2rem;
height: 2.3px;
background-color: rgb(255, 255, 255);
display: inline-block;
}
&::before,
&::after {
width: 1.5rem;
height: 2.3px;
background-color: rgb(255, 255, 255);
display: inline-block;
}
&::before,
&::after {
content: "";
position: absolute;
left: 0;
transition: all .2s;
}
&::before { top: -.6rem }
&::after { bottom: -.65rem }
}
&__button:hover &__icon::before {
top: -.85rem;
}
&__button:hover &__icon::after {
bottom: -.9rem;
}
&__checkbox:checked + &__button &__icon {
background-color: transparent;
}
&__checkbox:checked + &__button &__icon::before {
transform: rotate(135deg);
top: 0;
}
&__checkbox:checked + &__button &__icon::after {
transform: rotate(-135deg);
bottom: 0;
}
}
//navigation list
#hd {
margin-top: 2rem;
}
.resume{
font-size: 2rem;
color: #e7e7e7;
font-family: "montserrat-regular", sans-serif;
letter-spacing: -2px;
transition: all .2s ease-in-out;
}
.resume:hover {
text-align: center;
color: #c5c1c1;
letter-spacing: 3px;
}
#in-nav{
font-family: "montserrat-regular", sans-serif;
font-weight: 500;
}
#both{
margin-left: 1.9rem;
}
.list h6{
font-family: "montserrat-regular", sans-serif;
}
.ul li {
list-style: none;
padding-bottom: .6rem;
}
.ul li a {
color: #2c2c2c;
text-decoration: none;
font-size: 2rem;
font-family: "montserrat-regular", sans-serif;
text-decoration: none;
letter-spacing: -.7px;
cursor: pointer;
}
#c:hover {
color: #1d1d1d;
letter-spacing: 5px;
}
.social-intro h2, .contact-intro h2{
font-family: cursive;
}
#social-links{
margin-bottom: 10rem;
}
.social-links i{
margin-right: 1rem;
}
.social-links i:hover{
cursor: pointer;
}
.em{
margin-left: -12rem;
}
#contact{
margin-bottom: 7rem;
}
.copyright{
font-family: "montserrat-regular", sans-serif;
}
#ctc h6{
font-family: "montserrat-semibold", sans-serif;
}
#ctc a{
text-decoration: none;
}
#ctc h3{
color: #fff;
}
#ctc h3:hover{
color: #ee9c3e;
transition: 0.3s ease-in-out;
}
If I were doing this, I would use a JavaScript onClick function call to hide the outermost DIV element of the navigation bar.
I found this previous discussion of this very subject which may be worth checking out.
Update
On a site I previously built, this is the code I used: In my HTML page code I had:
<div id="overlay" style="display:block;"></div>
<div id="tos" style="display:block;">
On the A HREF link I added:
onclick="toggleOverlay('tos')
and the JavaScript code was
function toggleOverlay(overlay) {
// Get the DOM reference
var tosId = document.getElementById(overlay);
var overlayId = document.getElementById("overlay");
// Toggle
tosId.style.display == "block" ? tosId.style.display = "none" : tosId.style.display = "block";
overlayId.style.display == "block" ? overlayId.style.display = "none" : overlayId.style.display = "block";
}
Here I have two blogs, each has an Image, a heading and blog excerpt. When you hover over the blog an overlay appears on the image. I don't want the whole blog to act as a link, What I actually want is I want the heading and overlay both to act as a link. Giving the link to the heading was easy. I have the link to the image but when the overlay covers the image, the link goes off. Just need the overlay to act as a link too.
Here is the Fiddle
.row {
position: relative;
width: 1140px;
margin: 0 auto 40px;
}
.blog-item-inner {
background-color: #fbfbfb;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
}
.blog-img-inner {
position: relative;
overflow: hidden;
text-align: center;
transition: all 0.4s ease-in-out;
}
.blog-post-date {
position: absolute;
top: 35px;
left: 35px;
border: 2px solid #ffffff;
text-align: center;
width: 40px;
height: 35px;
z-index: 999;
}
.blog-post-date p {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #ffffff;
line-height: 1;
margin-top: 0px;
padding: 5px 10px;
}
.blog-post-date span {
font-family: 'Open Sans', sans-serif;
font-size: 8px;
color: #ffffff;
line-height: 1;
font-weight: 400;
margin-bottom: 0;
display: block;
margin-top: 3px;
}
.blog-title-excerpt {
padding: 40px 40px 30px;
}
.blog-title-excerpt h3 {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #000000;
margin-top: 0;
margin-bottom: 15px;
}
.blog-title-excerpt p {
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 400;
color: #888888;
margin-bottom: 0;
}
.blog-image {
position: relative;
margin-bottom: 24px;
transition: box-shadow 0.3s linear;
}
.blog-img-inner:before {
content: "";
background: rgba(0, 0, 0, 0.5);
transition: all 0.5s ease-in-out;
height: 0;
width: 100%;
position: absolute;
bottom: 0;
display: block;
}
.blog-item-inner:hover .blog-img-inner:before {
height: 100%;
}
.blog-image .post-meta {
position: absolute;
right: 12px;
bottom: 12px;
display: block;
z-index: 15;
}
.blog-content a {
color: #222222;
text-decoration: none;
font-family: "Droid Serif", sans-serif;
}
.post-meta {
display: block;
margin-top: 10px;
cursor: pointer;
}
.post-meta span {
margin-right: 10px;
font-size: 12px;
color: #c0c0c0;
transition: all 0.3s ease-in-out;
}
.post-meta span:hover {
color: #777777;
}
.col6 {
width: 47.96%;
}
.col {
display: inline-block;
float: left;
margin-right: 4%;
}
.col:last-child {
margin-right: 0;
}
<div class="row clearfix">
<div class="col col6 blog-items">
<div class="blog-item-inner clearfix">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>18 <span>DEC</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a pulse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 183</span>
<span><i class="fa fa-comment-o"></i> 57</span>
</div>
</div>
</div>
</div>
<div class="col col6 blog-items">
<div class="blog-item-inner">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>12 <span>JUN</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a puIse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 120</span>
<span><i class="fa fa-comment-o"></i> 18</span>
</div>
</div>
</div>
</div>
</div>
the easiest way is to wrap .blog-img-inner with a and your problem will be solved, check the updated snippet:
.row {
position: relative;
width: 1140px;
margin: 0 auto 40px;
}
.blog-item-inner {
background-color: #fbfbfb;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
}
.blog-img-inner {
position: relative;
overflow: hidden;
text-align: center;
transition: all 0.4s ease-in-out;
}
.blog-post-date {
position: absolute;
top: 35px;
left: 35px;
border: 2px solid #ffffff;
text-align: center;
width: 40px;
height: 35px;
z-index: 999;
}
.blog-post-date p {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #ffffff;
line-height: 1;
margin-top: 0px;
padding: 5px 10px;
}
.blog-post-date span {
font-family: 'Open Sans', sans-serif;
font-size: 8px;
color: #ffffff;
line-height: 1;
font-weight: 400;
margin-bottom: 0;
display: block;
margin-top: 3px;
}
.blog-title-excerpt {
padding: 40px 40px 30px;
}
.blog-title-excerpt h3 {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #000000;
margin-top: 0;
margin-bottom: 15px;
}
.blog-title-excerpt p {
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 400;
color: #888888;
margin-bottom: 0;
}
.blog-image {
position: relative;
margin-bottom: 24px;
transition: box-shadow 0.3s linear;
}
.blog-img-inner:before {
content: "";
background: rgba(0, 0, 0, 0.5);
transition: all 0.5s ease-in-out;
height: 0;
width: 100%;
position: absolute;
bottom: 0;
display: block;
}
.blog-item-inner:hover .blog-img-inner:before {
height: 100%;
}
.blog-image .post-meta {
position: absolute;
right: 12px;
bottom: 12px;
display: block;
z-index: 15;
}
.blog-content a {
color: #222222;
text-decoration: none;
font-family: "Droid Serif", sans-serif;
}
.post-meta {
display: block;
margin-top: 10px;
cursor: pointer;
}
.post-meta span {
margin-right: 10px;
font-size: 12px;
color: #c0c0c0;
transition: all 0.3s ease-in-out;
}
.post-meta span:hover {
color: #777777;
}
.col6 {
width: 47.96%;
}
.col {
display: inline-block;
float: left;
margin-right: 4%;
}
.col:last-child {
margin-right: 0;
}
<div class="row clearfix">
<div class="col col6 blog-items">
<div class="blog-item-inner clearfix">
<a href="#"><div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>18 <span>DEC</span></p>
</div>
</div></a>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a pulse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 183</span>
<span><i class="fa fa-comment-o"></i> 57</span>
</div>
</div>
</div>
</div>
<div class="col col6 blog-items">
<div class="blog-item-inner">
<a href="#"><div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>12 <span>JUN</span></p>
</div>
</div></a>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a puIse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 120</span>
<span><i class="fa fa-comment-o"></i> 18</span>
</div>
</div>
</div>
</div>
</div>
.row {
position: relative;
width: 1140px;
margin: 0 auto 40px;
}
.blog-item-inner {
background-color: #fbfbfb;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
}
.blog-img-inner {
position: relative;
overflow: hidden;
text-align: center;
transition: all 0.4s ease-in-out;
}
.blog-post-date {
position: absolute;
top: 35px;
left: 35px;
border: 2px solid #ffffff;
text-align: center;
width: 40px;
height: 35px;
z-index: 999;
}
.blog-post-date p {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #ffffff;
line-height: 1;
margin-top: 0px;
padding: 5px 10px;
}
.blog-post-date span {
font-family: 'Open Sans', sans-serif;
font-size: 8px;
color: #ffffff;
line-height: 1;
font-weight: 400;
margin-bottom: 0;
display: block;
margin-top: 3px;
}
.blog-title-excerpt {
padding: 40px 40px 30px;
}
.blog-title-excerpt h3 {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #000000;
margin-top: 0;
margin-bottom: 15px;
}
.blog-title-excerpt p {
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 400;
color: #888888;
margin-bottom: 0;
}
.blog-image {
position: relative;
margin-bottom: 24px;
transition: box-shadow 0.3s linear;
}
.overly {
content: "";
background: rgba(0, 0, 0, 0.5);
transition: all 0.5s ease-in-out;
height: 0;
width: 100%;
position: absolute;
bottom: 0;
display: block;
}
.blog-item-inner:hover .overly {
height: 100%;
}
.blog-image .post-meta {
position: absolute;
right: 12px;
bottom: 12px;
display: block;
z-index: 15;
}
.blog-content a {
color: #222222;
text-decoration: none;
font-family: "Droid Serif", sans-serif;
}
.post-meta {
display: block;
margin-top: 10px;
cursor: pointer;
}
.post-meta span {
margin-right: 10px;
font-size: 12px;
color: #c0c0c0;
transition: all 0.3s ease-in-out;
}
.post-meta span:hover {
color: #777777;
}
.col6 {
width: 47.96%;
}
.col {
display: inline-block;
float: left;
margin-right: 4%;
}
.col:last-child {
margin-right: 0;
}
<div class="row clearfix">
<div class="col col6 blog-items">
<div class="blog-item-inner clearfix">
<div class="blog-img-inner">
<a href="#"><img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<span class="overly"> </span>
</a>
<div class="blog-post-date">
<p>18 <span>DEC</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a pulse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 183</span>
<span><i class="fa fa-comment-o"></i> 57</span>
</div>
</div>
</div>
</div>
<div class="col col6 blog-items">
<div class="blog-item-inner">
<div class="blog-img-inner">
<a href="#"><img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<span class="overly"> </span>
</a>
<div class="blog-post-date">
<p>12 <span>JUN</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a puIse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 120</span>
<span><i class="fa fa-comment-o"></i> 18</span>
</div>
</div>
</div>
</div>
</div>
Simply put some JS on wrapper <div class="blog-item-inner clearfix" onClick="location.href='http://example.com'">
.row {
position: relative;
width: 1140px;
margin: 0 auto 40px;
}
.blog-item-inner {
background-color: #fbfbfb;
box-sizing: border-box;
transition: all 0.4s ease-in-out;
cursor: pointer;
}
.blog-img-inner {
position: relative;
overflow: hidden;
text-align: center;
transition: all 0.4s ease-in-out;
}
.blog-post-date {
position: absolute;
top: 35px;
left: 35px;
border: 2px solid #ffffff;
text-align: center;
width: 40px;
height: 35px;
z-index: 999;
}
.blog-post-date p {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #ffffff;
line-height: 1;
margin-top: 0px;
padding: 5px 10px;
}
.blog-post-date span {
font-family: 'Open Sans', sans-serif;
font-size: 8px;
color: #ffffff;
line-height: 1;
font-weight: 400;
margin-bottom: 0;
display: block;
margin-top: 3px;
}
.blog-title-excerpt {
padding: 40px 40px 30px;
}
.blog-title-excerpt h3 {
font-family: 'Open Sans', sans-serif;
font-size: 15px;
font-weight: 700;
color: #000000;
margin-top: 0;
margin-bottom: 15px;
}
.blog-title-excerpt p {
font-family: 'Open Sans', sans-serif;
font-size: 13px;
font-weight: 400;
color: #888888;
margin-bottom: 0;
}
.blog-image {
position: relative;
margin-bottom: 24px;
transition: box-shadow 0.3s linear;
}
.blog-img-inner:before {
content: "";
background: rgba(0, 0, 0, 0.5);
transition: all 0.5s ease-in-out;
height: 0;
width: 100%;
position: absolute;
bottom: 0;
display: block;
}
.blog-item-inner:hover .blog-img-inner:before {
height: 100%;
}
.blog-image .post-meta {
position: absolute;
right: 12px;
bottom: 12px;
display: block;
z-index: 15;
}
.blog-content a {
color: #222222;
text-decoration: none;
font-family: "Droid Serif", sans-serif;
}
.post-meta {
display: block;
margin-top: 10px;
cursor: pointer;
}
.post-meta span {
margin-right: 10px;
font-size: 12px;
color: #c0c0c0;
transition: all 0.3s ease-in-out;
}
.post-meta span:hover {
color: #777777;
}
.col6 {
width: 47.96%;
}
.col {
display: inline-block;
float: left;
margin-right: 4%;
}
.col:last-child {
margin-right: 0;
}
<div class="row clearfix">
<div class="col col6 blog-items">
<div class="blog-item-inner clearfix" onClick="location.href='#'">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>18 <span>DEC</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a pulse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 183</span>
<span><i class="fa fa-comment-o"></i> 57</span>
</div>
</div>
</div>
</div>
<div class="col col6 blog-items">
<div class="blog-item-inner">
<div class="blog-img-inner">
<img src="https://image.ibb.co/b8UnFw/blog1.jpg" alt="blog1">
<div class="blog-post-date">
<p>12 <span>JUN</span></p>
</div>
</div>
<div class="blog-title-excerpt">
<h5 class="fancy-heading-s1">ENDLESS ROAD STARTS</h5>
<p>No one rejects, dislikes, or avoids pleasure those who do not know a puIse</p>
<div class="post-meta">
<span><i class="fa fa-thumbs-o-up"></i> 120</span>
<span><i class="fa fa-comment-o"></i> 18</span>
</div>
</div>
</div>
</div>
</div>
How to use an overlay effect over an image with text inside.
Fiddle
<div class="ft-item">
<span class="ft-image">
<img src="https://image.ibb.co/irjHmR/backwater.jpg" alt="featured Scroller" draggable="false">
</span>
<div class="ft-data">
<a class="text-upper" href="#">
<h5 class="itemh5">Test Content</h5>
</a>
</div>
</div>
I tried by using this but it doesnot works as my need. example
Try this. I have changed some css.
.ft-item {
float: left;
margin-bottom: 0px;
position: relative;
}
.itemh5 {
color: #fff;
font-size: 15px;
font-weight: 300;
font-weight: 700;
letter-spacing: 0.5px;
margin-bottom: 0px;
font-family: 'Roboto Slab', serif;
font-weight: 500;
}
.ft-image {
float: left;
width: 100%;
display: block;
}
.ft-image img {
width: 100%;
height: auto;
}
.ft-data {
background: rgba(30, 110, 30, 0.68);
content: "";
height: 0;
left: 0;
position: absolute;
right: 0;
width: 100%;
-webkit-transition: .5s ease;
transition: .5s ease;
opacity: 0;
}
.ft-item:hover .ft-data {
height: 100%;
opacity: 1;
}
.ft-data .text-upper {
display: block;
left: 0;
position: absolute;
right: 0;
text-align: center;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.ft-foot {
float: left;
width: 100%;
padding: 3px 10px;
background: #000;
}
.ft-hotel,
.ft-plane,
.ft-tea,
.ft-boat,
.ft-car {
float: left;
height: 16px;
margin: 0 5px;
color: #292c2f;
padding-left: 20px;
font-size: 12px;
line-height: 20px;
}
.text-upper {
text-transform: uppercase;
}
.ft-title {
float: left;
font-size: 14px;
}
.ft-offer {
float: right;
color: #fff;
font-size: 11px;
font-weight: 700;
margin-top: 10px;
}
.panpad {
padding: 0px;
}
.ft-foot {
float: left;
width: 100%;
padding: 3px 10px;
background: #484848;
}
.ft-foot ul {
padding: 0;
margin: 0;
text-align: center;
}
.ft-foot li {
display: inline-block;
margin: 0 2px;
}
.inclusion {
color: white;
padding: 5px 0 10px 0;
display: block;
letter-spacing: 1px;
text-align: center;
}
.inclusion span {
display: block;
font-size: 8px;
text-transform: uppercase;
}
.inclusion i {
font-size: 20px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="col-md-6 col-sm-6">
<div class="panel panel-default">
<div class="panel-body panpad">
<div class="ft-item">
<span class="ft-image">
<img src="https://image.ibb.co/irjHmR/backwater.jpg" alt="featured Scroller" draggable="false">
</span>
<div class="ft-data">
<a class="text-upper" href="#"><h5 class="itemh5">Test Content</h5></a>
</div>
<div class="ft-foot">
<ul>
<li><a class="inclusion"><i class="fa fa-male" aria-hidden="true"></i><span>Guide</span></a></li>
<li><a class="inclusion"><i class="fa fa-car" aria-hidden="true"></i><span>Site seeing</span></a></li>
<li><a class="inclusion"><i class="fa fa-building-o" aria-hidden="true"></i><span>Hotels</span></a></li>
<li><a class="inclusion"><i class="fa fa-plane" aria-hidden="true"></i><span>Transportation</span></a></li>
<li><a class="inclusion"><i class="fa fa-cutlery" aria-hidden="true"></i><span>Food</span></a></li>
</ul>
</div>
<div class="ft-foot-ex">
</div>
</div>
</div>
</div>
</div>
I try to position div on another div.
when i hover on .lg-each-contest the .current-caption will appear.
when hover on .time the .current-caption hover will be same.
Here is my code
.lg-current-inner {
border: 1px solid #bdbdbd;
margin-bottom: 30px;
position: relative;
}
.lg-each-contest:hover .current-caption {
opacity: 1;
}
.lg-current-banner .amount {
position: absolute;
top: 5px;
background-color: #fea700;
padding: 5px 12px;
font-size: 22px;
right: 0;
font-weight: 600;
color: #fff;
}
.lg-current-content {
padding: 10px;
}
.lg-current-content h3 {
font-size: 24px;
line-height: 36px;
margin-top: 10px;
}
.time {
border-top: 1px solid #bdbdbd;
position: relative;
}
.time .remaning-time {
padding: 10px;
}
.time .remaning-time .each-time {
font-size: 14px;
font-weight: 500;
}
.time .remaning-time .submissions {
padding: 2px 10px;
background: #1bcd80;
font-weight: 500;
color: #fff;
border-radius: 2px;
}
.current-caption {
position: absolute;
top: 0;
left: 0;
cursor: pointer;
right: 0;
bottom: 0;
padding: 25% 0;
width: 100%;
height: 100%;
background-color: rgba(63, 97, 132, 0.5);
text-align: center;
font-size: 15px;
opacity: 0;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
-ms-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.current-caption button {
color: #fea700;
padding: 6px 20px;
opacity: 1;
border-radius: 4px;
background: #fff;
font-weight: 600;
font-size: 16px;
position: relative;
top: 50%;
outline-color: transparent;
border: none;
}
.current-caption button:hover {
border-color: transparent;
border: none;
}
.current-caption button:focus {
border-color: transparent;
border: none;
}
.current-caption button .fa {
margin-right: 5px;
}
.seclected {
display: none;
}
<div class="lg-current-inner">
<div class="lg-each-contest">
<div class="lg-current-banner">
<img src="assets/images/gl-1.jpg" alt="" class="img-responsive">
<span class="amount">$130</span>
</div>
<div class="lg-current-content">
<h3>Logo Name here</h3>
<p>We are looking for a clean logol company strickt.</p>
</div>
<div class="current-caption">
<button class="select-btn">
<span class="select">Select</span>
<span class="seclected select">Selected</span>
</button>
</div>
</div>
<div class="time">
<div class="remaning-time">
<span class="each-time"> 25 Days 13 Hours 00 min</span>
<span class="pull-right submissions" data-toggle="tooltip" data-placement="top" title="Submissions" data-toggle="tooltip" data-placement="top" title="Submissions">344</span>
</div>
</div>
</div>
check demo: http://codepen.io/anon/pen/MpoMad?editors=1100
thanks in advance.
I hope this is what you are looking for. Add a z-index for your div this will avoid that text from appearing on the hover div, as well as the padding seems to be unwanted I have removed that too.
<!DOCTYPE html>
<html>
<head>
<style>
.lg-current-inner {
border: 1px solid #bdbdbd;
margin-bottom: 30px;
position: relative;
}
.lg-each-contest {
overflow: hidden;
position: relative;
}
.lg-each-contest:hover .current-caption {
opacity: 1;
}
.lg-current-banner .amount {
position: absolute;
top: 5px;
background-color: #fea700;
padding: 5px 12px;
font-size: 22px;
right: 0;
font-weight: 600;
color: #fff;
}
.lg-current-content {
padding: 10px;
}
.lg-current-content h3 {
font-size: 24px;
line-height: 36px;
margin-top: 10px;
}
.time {
border-top: 1px solid #bdbdbd;
position: relative;
}
.time .remaning-time {
padding: 10px;
}
.time .remaning-time .each-time {
font-size: 14px;
font-weight: 500;
}
.time .remaning-time .submissions {
padding: 2px 10px;
background: #1bcd80;
font-weight: 500;
color: #fff;
border-radius: 2px;
}
.current-caption {
position: absolute;
top: 0;
left: 0;
cursor: pointer;
right: 0;
bottom: 0;
/*padding: 25% 0;*/
z-index: 10000;
width: 100%;
height: 100%;
background-color: rgba(63, 97, 132, 0.5);
text-align: center;
font-size: 15px;
opacity: 0;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
-ms-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.current-caption button {
color: #fea700;
padding: 6px 20px;
opacity: 1;
border-radius: 4px;
background: #fff;
font-weight: 600;
font-size: 16px;
position: relative;
top: 50%;
outline-color: transparent;
border: none;
}
.current-caption button:hover {
border-color: transparent;
border: none;
}
.current-caption button:focus {
border-color: transparent;
border: none;
}
.current-caption button .fa {
margin-right: 5px;
}
.seclected {
display: none;
}
</style>
</head>
<body>
<div class="col-sm-3 wow fadeInRight" data-wow-delay="0.2s">
<div class="lg-current-inner">
<div class="lg-each-contest">
<div class="lg-current-banner">
<img src="assets/images/gl-1.jpg" alt="" class="img-responsive">
<span class="amount">$130</span>
</div>
<div class="lg-current-content">
<h3>Logo Name here</h3>
<p>We are looking for a clean logo that pops apparel company strickt.</p>
</div>
<div class="current-caption">
<button class="select-btn">
<span class="select">Select</span>
<span class="seclected select"><i class="fa fa-check-circle"></i>Selected</span>
</button>
</div>
</div>
<div class="time">
<div class="remaning-time">
<span class="each-time"><i class="fa fa-calendar"></i> 25 Days 13 Hours 00 min</span>
<span class="pull-right submissions" data-toggle="tooltip" data-placement="top" title="Submissions" data-toggle="tooltip" data-placement="top" title="Submissions">344</span>
</div>
</div>
</div>
</div>
</body>
</html>
Modifications.
Set overflow: hidden and position: relative for the lg-each-contest class. This will stops the overflow of the hovering div. I have updated the code.
I have no idea about what you are asking. But when I run the code I saw the cursor is not showing the pointer on the button. I just add some code to your CSS file.
.current-caption button {
+ cursor: pointer;
}
.current-caption button:hover {
+ background: #000;
}
.current-caption must be on top while .lg-each-contest is hovering only
.lg-current-inner {
border: 1px solid #bdbdbd;
margin-bottom: 30px;
position: relative;
}
.lg-each-contest:hover .current-caption {
opacity: 1;
z-index:2; /* added */
}
.lg-current-banner .amount {
position: absolute;
top: 5px;
background-color: #fea700;
padding: 5px 12px;
font-size: 22px;
right: 0;
font-weight: 600;
color: #fff;
}
.lg-current-content {
padding: 10px;
}
.lg-current-content h3 {
font-size: 24px;
line-height: 36px;
margin-top: 10px;
}
.time {
border-top: 1px solid #bdbdbd;
position: relative;
}
.time .remaning-time {
padding: 10px;
}
.time .remaning-time .each-time {
font-size: 14px;
font-weight: 500;
}
.time .remaning-time .submissions {
padding: 2px 10px;
background: #1bcd80;
font-weight: 500;
color: #fff;
border-radius: 2px;
}
.current-caption {
position: absolute;
top: 0;
left: 0;
cursor: pointer;
right: 0;
bottom: 0;
/*padding: 25% 0;*/ /* removed */
width: 100%;
height: 100%;
background-color: rgba(63, 97, 132, 0.5);
text-align: center;
font-size: 15px;
opacity: 0;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
-ms-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.current-caption button {
color: #fea700;
padding: 6px 20px;
opacity: 1;
border-radius: 4px;
background: #fff;
font-weight: 600;
font-size: 16px;
position: relative;
top: 50%;
outline-color: transparent;
border: none;
}
.current-caption button:hover {
border-color: transparent;
border: none;
}
.current-caption button:focus {
border-color: transparent;
border: none;
}
.current-caption button .fa {
margin-right: 5px;
}
.seclected {
display: none;
}
<div class="lg-current-inner">
<div class="lg-each-contest">
<div class="lg-current-banner">
<img src="assets/images/gl-1.jpg" alt="" class="img-responsive">
<span class="amount">$130</span>
</div>
<div class="lg-current-content">
<h3>Logo Name here</h3>
<p>We are looking for a clean logol company strickt.</p>
</div>
<div class="current-caption">
<button class="select-btn">
<span class="select">Select</span>
<span class="seclected select">Selected</span>
</button>
</div>
</div>
<div class="time">
<div class="remaning-time">
<span class="each-time"> 25 Days 13 Hours 00 min</span>
<span class="pull-right submissions" data-toggle="tooltip" data-placement="top" title="Submissions" data-toggle="tooltip" data-placement="top" title="Submissions">344</span>
</div>
</div>
</div>
here just added z-index
.lg-each-contest:hover .current-caption {
++ z-index:2;
}
removed padding to fit container
.current-caption {
-- padding: 25% 0;
}