This is the portion of my HTML: I want to have to the text fixed to an image and not disappear when I stop hovering on the text.
.overlay1 {
position: relative;
bottom: 0;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.5); /* Black see-through */
color: #f1f1f1;
width: 100%;
transition: .5s ease;
opacity:0;
color: white;
font-size: 20px;
padding: 20px;
text-align: center;
}
/*Test hover*/
.container1:hover .overlay1 {
opacity: 0.5;
}
<div class="container1">
<a href="/content/gallery">
<div class="columny">
<div class="row1">
<img src="sites/chau.ac.zm/themes/chau/images/AF.jpg" alt="Snow" class="image" style="width:100%">
<!-- <div class="overlay1"> -->
<div class="overlay1">Gallery</div>
<!-- </div> -->
</div>
</div>
</a>
</div>
If I get you right, you want div.overlay1 to
be invisible initially
be visible on hover over div.container1
stay visible even if you hover out of div.container1
You cannot achieve 3. without using JavaScript.
I suggest this code:
/* You need this container to limit the .overlay1 position */
.img-container {
position: relative;
}
.overlay1 {
position: absolute;
bottom: 0;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.5); /* Black see-through */
color: #f1f1f1;
width: 100%;
transition: .5s ease;
opacity:0;
color: white;
font-size: 20px;
padding: 20px;
text-align: center;
}
/*Test hover - change :hover to class .visible */
.container1.visible .overlay1 {
opacity: 0.5;
}
<div id="container1" class="container1">
<a href="/content/gallery">
<div class="columny">
<div class="row1">
<div class="img-container">
<img src="https://images.unsplash.com/photo-1462899006636-339e08d1844e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&h=150&q=80" alt="Snow" class="image" style="width:100%">
<!-- <div class="overlay1"> -->
<div class="overlay1">Gallery</div>
<!-- </div> -->
</div>
</div>
</div>
</a>
</div>
<script>
// get element
var container1 = document.getElementById("container1");
// add hover event function
container1.addEventListener("mouseover", function() {
container1.className = "container1 visible";
});
</script>
See the solution if it works!
Just one question:
If you need a text to be fixed to an image, then why are you using hover?
.overlay1 {
position: absolute;
background: rgb(0, 0, 0);
background: rgba(0, 0, 0, 0.5); /* Black see-through */
color: #f1f1f1;
width: auto;
transition: .5s ease;
opacity:1;
color: white;
font-size: 20px;
padding: 20px;
text-align: center;
right:-20px;
top:50%;
}
.row1{
position:relative;
width:500px; margin:0 auto;
}
<div class="container1">
<a href="/content/gallery">
<div class="columny">
<div class="row1">
<img src="https://image.shutterstock.com/image-photo/field-spring-flowers-sunlight-450w-377208970.jpg" alt="" />
<!-- <div class="overlay1"> -->
<div class="overlay1">Gallery</div>
<!-- </div> -->
</div>
</div>
</a>
</div>
remove class from gallery div
<div class="overlay1">Gallery</div> remove the class and use without any "overlay1"class
Related
so im having little bit of strugle making this work.
So basicly what i am trying to make is image with caption under it and when you hover over image it gets greenish color with transparency and a plus sign on it.
What ive tried so far is to make <div class=parent> and inside of <div class=parent> i would have <img> and another <div class="overlay">
HTML
<section class="gallery">
<div class="container">
<div class="row">
<div class="parent">
<img src="img/showcase.jpg">
<div class="overlay">
<i class="fas fa-plus"></i>
</div>
</div>
</div>
</div>
</section>
CSS
.gallery .overlay {
background: rgba(0, 188, 156, 0);
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
} /* this div overlay will be greenish transparent color over an image when image is hovered */
.gallery .parent {
margin-top: 40px;
} /* this is just some spacing when images go one under another */
.gallery .parent:hover .overlay {
background: rgba(0, 188, 156, 0.8);
}
.gallery .parent:hover .fa-plus {
color: white;
}
.gallery .fa-plus {
position: absolute;
top: 50%;
left: 50%;
color: rgba(255, 255, 255, 0);
font-size: 1.75em;
}
so this works perfectly fine.
But when i put caption in my HTML.
<section class="gallery">
<div class="container">
<div class="row">
<div class="parent">
<img src="img/showcase.jpg">
<div class="overlay">
<i class="fas fa-plus"></i>
</div>
<div class="caption">
<h5>Lorem ipsum dolor.</h5>
<h6>lorem</h6>
</div>
</div>
</div>
<div class="overlay"> stretches all the way down
im running out of ideas how to make this possible especially because i need it to be responsive, images are changing widths and heights based on the resolution so i can put <div class="overlay> height on 80% or 90%
EG on medium devices.
Put the image inside its own container where you can add the overlay:
.img-container {
display:inline-block;
position:relative;
}
.img-container img {
display:block;
}
.overlay {
background: rgba(0, 188, 156, 0);
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.gallery .parent {
margin-top: 40px;
}
.gallery .img-container:hover .overlay {
background: rgba(0, 188, 156, 0.8);
}
.gallery .img-container:hover .fa-plus {
color: white;
}
.gallery .fa-plus {
position: absolute;
top: 50%;
left: 50%;
color: rgba(255, 255, 255, 0);
font-size: 1.75em;
}
<section class="gallery">
<div class="container">
<div class="row">
<div class="parent">
<div class="img-container">
<img src="https://lorempixel.com/400/200/ ">
<div class="overlay ">
<i class="fas fa-plus ">+</i>
</div>
</div>
<div class="caption ">
<h5>Lorem ipsum dolor.</h5>
<h6>lorem</h6>
</div>
</div>
</div>
I am doing a popup image with close button and dimmed background. When the popup is displayed and users click outside of it, it supposes to close the popup. It works fine on other browser, but not safari. I found on Z-index problems on ipad that I need to put -webkit-transform: translate3d(0,0,0) to the same DOM level but I am not really sure about the concept. Can someone help me, please?
Here is my code:
/**********************HTMl*********************/
<body id="price">
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<?php include('header.php')?>
<div id="content-border" >
<div id="content">
<h1><strong>Packages</strong></h1>
<P id="package-p"></P>
<div>
<div id="price-col">
<button class="img-circle" id="price-circle" id="myBtn1" onClick="openPopup(1)">
<div>
<h4></h4>
<span id="currency">$</span>
<span id="price-large"></span>
<p id="price-small"></p>
<p></p>
</div>
</button>
</div>
<div id="myModal1" class="popup">
<div class="popup-content">
<img src="images/The-Apprentice_low.jpg" id="popup-content1"><span class="closeBtn" onClick="closePopup()">×</span>
</div>
</div>
<div id="price-col">
<button class="img-circle" id="price-circle" id="myBtn2" onClick="openPopup(2)">
<div>
<h4></h4>
<span id="currency">$</span>
<span id="price-large"></span>
<p id="price-small"></p>
<p></p>
</div>
</button>
</div>
<div id="myModal2" class="popup">
<div class="popup-content">
<img src="images/The-Celebrity-Chef_low.jpg" id="popup-content2"><span class="closeBtn" onClick="closePopup()">×</span>
</div>
</div>
</div>
</div>
</div>
<?php include('footer.php')?>
</div>
</div>
</div>
<?php include('html-body-end.php')?>
</body>
/*************************CSS***********************/
#package-p{
background-color: #fff;
color: #000;
padding: 10 20;
text-shadow: none;
}
#price-col{
margin:0 auto;
width:50%;
float: left;
text-align: center;
}
#price-circle{
margin: 30 auto;
background: #ffffff;
padding: 35px;
text-align: center;
height: 250px;
width: 250px;
display: table;
color: #222222;
box-shadow: 0px 0px 10px 5px rgba(206, 44, 44, 0.5);
border: 0;
transition: all 0.3s;
-moz-transition: all 0.3s; /* Firefox 4 */
-webkit-transition: all 0.3s; /* Safari and Chrome */
-o-transition: all 0.3s; /* Opera */
}
#price-circle > div{
display: table-cell;
vertical-align: middle;
}
#currency{
font-size: 30px;
}
#price-circle:hover{
box-shadow: 0px 0px 10px 5px rgba(255, 255, 255, 0.5);
background-color: #ce2c2c;
color: #fff;
}
/*Popup*/
.popup {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
/* padding-top: 300px; Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
text-align: center;
}
.popup-content {
margin: auto;
color: #ffffff;
display: inline-block;
position: relative;
}
.popup::after, .popup::before{
display: block;
content: "";
height: 5%;
}
.popup-content img{
max-height: 90vh;
max-width: 90vw;
min-height: 170px;
min-width: 240px;
z-index: 10;
}
/* The Close Button */
.closeBtn{
color: rgba(255,255,255,5);
font-size: 36px;
font-weight: bold;
position: absolute;
margin-top: -2.1vh;
right: 0;
display: inline-block;
z-index: 10;
}
.closeBtn:hover, .closeBtn:focus{
color: #000;
cursor: pointer;
}
Thanks.
I'm trying to get an overlay or box shadow on top of a row of images. Then when you hover over these images, the opacity of the shadow should change from 0.5 to 0.8 for that image. I have already tried the pseudo technique suggested here:
How To Get Shadow With Certain Opacity Over Images CSS
And applied styles to the divs beneath the images as it was suggested here:
Why doesn't inset box-shadow work over images?
Me + several other people haven't been able to figure this out.
The goal is to get the images to look the same as the other three images above the row - the picture of the business presentation, the picture of the business meeting, and the picture of the businesswoman. Each of them have an initial box shadow over them with 50% opacity - then when you hover over the buttons (see my work, contact, and visit store), the opacity over the image should change from 50% to 80%. We want that same technique to be applied to the images in the row.
HTML:
<div class="row thumbnail-row">
<div class="my-work-image" id="margin-left-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/hamburger-thumbnail.jpg" />
<div class="img__description_layer">
<span class="img__description">The Hamburger Collection</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/yoyomoi-thumbnail.jpg" />
<div class="img__description_layer">
<span class="img__description">YoYoMoi</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/dogs-thumbnail.jpg" />
<div class="img__description_layer">
<span class="img__description">Dogs On Duty</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/gateway-thumbnail.jpg" />
<div class="img__description_layer">
<span class="img__description">Gateway Web Design</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/chameleon-thumbnail.jpg" />
<div class="img__description_layer">
<span class="img__description">Chameleon Web Solutions</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/adrienne-thumbnail.jpg" />
<div class="img__description_layer">
<span class="img__description">Adrienne Levin Coleman</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/castaway-thumbnail.jpg" />
<div class="img__description_layer">
<span class="img__description">Castaway Vacations</span>
</div>
</div>
CSS:
.thumbnail-row {
display: flex;
margin-top: 40px;
box-shadow: 0px 0px 0px 4000px rgba(27, 61, 88, 0.5) inset;
}
.thumbnail-row div::after {
position: relative;
top: 0; left: 0;
width: 100%;
height: 100%;
box-shadow: 0px 0px 0px 4000px rgba(27, 61, 88, 0.5) inset;
}
.thumbnail-image {
display: inline-block;
width: 100%;
/*opacity: 0.5;*/
/*box-shadow: inset 0 0 0 4000px rgba(27,61,88,.5)!important;*/
}
.my-work-image{
position:relative;
}
.img__description_layer {
position: absolute;
top: 0;
bottom: 0;
left: 0; /*change it to 50%, if you want the text only shows in the half part */
right: 0;
background: rgba(27,61,88, 0.8);
color: #ffffff;
visibility: hidden;
opacity: 0;
display: flex;
align-items: center;
text-align:center;
font-family: 'proxima_nova_ltsemibold';
box-shadow: 0px 0px 0px 4000px rgba(27, 61, 88, 0.5) inset;
/* transition effect. not necessary */
transition: opacity ease-in-out 0.4s, visibility ease-in-out 0.4s;
/*transition: box-shadow 0.4s ease-in-out;*/
}
.my-work-image:hover .img__description_layer {
visibility: visible;
opacity: 1;
}
.img__description {
transition: .2s;
transform: translateY(1em);
margin: 0 auto;
}
.my-work-image:hover .img__description {
transform: translateY(0);
}
#margin-left-image {
margin-left: 15px;
}
JSFiddle
Any other ideas for getting the images to have an initial box shadow over them?
The box-shadow isn't showing because the box-shadow is on the parent of the imgs, so the imgs are covering the box-shadow. You can move the imgs behind the parent by adding position: relative; z-index: -1;
.thumbnail-row {
display: flex;
margin-top: 40px;
box-shadow: 0px 0px 0px 4000px rgba(27, 61, 88, 0.5) inset;
}
.thumbnail-row div::after {
position: relative;
top: 0; left: 0;
width: 100%;
height: 100%;
box-shadow: 0px 0px 0px 4000px rgba(27, 61, 88, 0.5) inset;
}
.thumbnail-image {
display: inline-block;
width: 100%;
/*opacity: 0.5;*/
/*box-shadow: inset 0 0 0 4000px rgba(27,61,88,.5)!important;*/
}
.my-work-image{
position:relative;
}
.img__description_layer {
position: absolute;
top: 0;
bottom: 0;
left: 0; /*change it to 50%, if you want the text only shows in the half part */
right: 0;
background: rgba(27,61,88, 0.8);
color: #ffffff;
visibility: hidden;
opacity: 0;
display: flex;
align-items: center;
text-align:center;
font-family: 'proxima_nova_ltsemibold';
box-shadow: 0px 0px 0px 4000px rgba(27, 61, 88, 0.5) inset;
/* transition effect. not necessary */
transition: opacity ease-in-out 0.4s, visibility ease-in-out 0.4s;
/*transition: box-shadow 0.4s ease-in-out;*/
}
.my-work-image:hover .img__description_layer {
visibility: visible;
opacity: 1;
}
.img__description {
transition: .2s;
transform: translateY(1em);
margin: 0 auto;
}
.my-work-image:hover .img__description {
transform: translateY(0);
}
#margin-left-image {
margin-left: 15px;
}
.thumbnail-image {
position: relative;
z-index: -1;
}
<div class="row thumbnail-row">
<div class="my-work-image" id="margin-left-image">
<img class="thumbnail-image" src="http://i.imgur.com/mNoKbYK.jpg" />
<div class="img__description_layer">
<span class="img__description">The Hamburger Collection</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="http://i.imgur.com/8b2sb03.jpg" />
<div class="img__description_layer">
<span class="img__description">YoYoMoi</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="http://i.imgur.com/Ac11pRH.jpg" />
<div class="img__description_layer">
<span class="img__description">Dogs On Duty</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="http://i.imgur.com/DgNt5MQ.jpg" />
<div class="img__description_layer">
<span class="img__description">Gateway Web Design</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="http://i.imgur.com/SG0bpMU.jpg" />
<div class="img__description_layer">
<span class="img__description">Chameleon Web Solutions</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="http://i.imgur.com/x1DxQwd.jpg" />
<div class="img__description_layer">
<span class="img__description">Adrienne Levin Coleman</span>
</div>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="http://i.imgur.com/YcnOqR1.jpg" />
<div class="img__description_layer">
<span class="img__description">Castaway Vacations</span>
</div>
</div>
</div><!--end row-->
I want to add a multiply blend mode effect on image when hover. Right now when I hover, it's just a solid colored layer with an opacity on top. I tried background-blend-mode but didn't work. Here's my code:
.imgwrapper {
position: relative;
}
.showtext:hover + div {
display: block;
}
.showtext:hover {
-webkit-filter:blur(2px);
filter: blur(2px);
}
.imagess:hover > .overlay {
left: 0px;
top: 0px;
right:0;
bottom:0;
width:250px;
height:250px;
position:absolute;
background-color:#b41f24;
opacity:0.85;
border-radius:0px;
}
.overlay #view {
position: absolute;
left: 108px;
top: 108px;
color: white;
text-decoration:underline;
display: block;
pointer-events: none;
font-size: 18px;
width: 250px;
letter-spacing: 4px;
}
<a href="single-illustration-sidebar-left.html" class="permalink">
<div class="desktop-3 mobile-half columns">
<div class="item">
<h3>Pawsome</h3>
<span class="category">ux/ui, web</span>
<div class="imgwrapper">
<div class="imagess">
<img class="showtext" src="images/thumb_item09.png" />
<div class="overlay">
<div id="view">view</div></div></div></div>
</div>
</div><!-- // .item -->
<!-- // .desktop-3 -->
</a>
Thank you
This should help you.
You need to have the image as a background-image to add blending-mode.
.imgwrapper {
position: relative;
}
.showtext {
width: 250px;
height: 250px;
background-image: url(https://unsplash.it/200/300/?random);
background-size: cover;
background-color: #b41f24;
transition: all 0.1s ease;
}
.showtext:hover + div {
display: block;
}
.showtext:hover {
-webkit-filter: blur(2px);
filter: blur(2px);
background-blend-mode: multiply;
}
.overlay #view {
position: absolute;
left: 108px;
top: 108px;
color: white;
text-decoration: underline;
display: block;
pointer-events: none;
font-size: 18px;
width: 250px;
letter-spacing: 4px;
z-index: 100;
}
<a href="single-illustration-sidebar-left.html" class="permalink">
<div class="desktop-3 mobile-half columns">
<div class="item">
<h3>Pawsome</h3>
<span class="category">ux/ui, web</span>
<div class="imgwrapper">
<div class="imagess">
<div class="showtext"></div>
<div class="overlay">
<div id="view">view</div>
</div>
</div>
</div>
</div>
</div>
<!-- // .item -->
<!-- // .desktop-3 -->
</a>
I have two rows of 4-boxed divs. The goal is to have a header within each box, and then hovering over the box will present more detailed p text with a faded background. I'm close, I just can't figure out how to actually layer the span overlay on top of the div instead of it being padded out of the way. Any help would be hugely appreciated!
.box {
width: 200px;
float: left;
box-shadow: inset 1px 1px 40px 0 rgba(90, 90, 90, .25);
margin: 5% auto 0 auto;
background-color: #DE5D40;
background-size: cover;
border-radius: 5px;
overflow: hidden;
}
.overlay {
background: rgba(0, 0, 0, .75);
text-align: center;
padding: 45px 0 66px 0;
opacity: 0;
-webkit-transition: opacity .25s ease;
-moz-transition: opacity .25s ease;
z-index: 10;
}
.box:hover .overlay {
opacity: 1;
}
.overlayText {
font-family: Helvetica;
font-weight: 14;
color: rgba(255, 255, 255, .85);
font-size: 14px;
}
.one-fourth.box {
margin-bottom: 20px;
height: 130px;
}
/* Column Classes
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
.three-fourths,
.three-sixths,
.two-fourths,
.two-sixths,
.two-thirds {
float: left;
margin-left: 2.564102564102564%;
}
.one-half,
.three-sixths,
.two-fourths {
width: 48.717948717948715%;
}
.one-third,
.two-sixths {
width: 31.623931623931625%;
}
.four-sixths,
.two-thirds {
width: 65.81196581196582%;
}
.one-fourth {
width: 23.076923076923077%;
}
.three-fourths {
width: 74.35897435897436%;
}
.one-sixth {
width: 14.52991452991453%;
}
.five-sixths {
width: 82.90598290598291%;
}
.first {
clear: both;
margin-left: 0;
}
<div class="one-fourth first box box1">
<h3>SEO</h3>
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box2">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box3">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box4">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth first box box5">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box6">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box7">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box8">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
Check the code below should be what your after.
They key here is positioning.
What you want is a box that overlays its container and has text in the dead center.
In these instances position:absolute & position:relative mean everything.
A small understanding of relativity would help in this situation but until you crack open a copy of the theory of relativity you can have this.
Your container will be relatively positioned. this means it is positioned relatively to the content surrounding it. But it also has a second cascaded function.
It tell's an absolutely positioned element to behave Absolutely relative to its container.
so when this happens we can use top,bottom,left & right to control where it should sit in the container absolutely.
so what we want to happen is for your text to sit dead center so in this case we tell it to have top,left,bottom & right 0px & margin:auto;
This will tell your element that it is not taking positioning rules from any one point of your container and it wants its marginalizing to be automatically thought out, but since you have defined all the axis that it can be positioned from it will margin it to the center.
Hope it help's you understand a little on why this happens.
.box {
position: relative;
width: 200px;
float: left;
box-shadow: inset 1px 1px 40px 0 rgba(90, 90, 90, .25);
margin: 5% auto 0 auto;
background-color: #DE5D40;
background-size: cover;
border-radius: 5px;
overflow: hidden;
}
.overlay {
top: 0px;
left: 0px;
position: absolute;
background: rgba(0, 0, 0, .75);
text-align: center;
opacity: 0;
-webkit-transition: opacity .25s ease;
-moz-transition: opacity .25s ease;
z-index: 10;
width:100%;
height:inherit;
}
.box:hover .overlay {
opacity: 1;
}
.overlayText {
position: absolute;
margin: auto;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
font-family: Helvetica;
font-weight: 14;
color: rgba(255, 255, 255, .85);
font-size: 14px;
height:15px;
}
.one-fourth.box {
margin-bottom: 20px;
height: 130px;
}
/* Column Classes
Link: http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css
--------------------------------------------- */
.five-sixths,
.four-sixths,
.one-fourth,
.one-half,
.one-sixth,
.one-third,
.three-fourths,
.three-sixths,
.two-fourths,
.two-sixths,
.two-thirds {
float: left;
margin-left: 2.564102564102564%;
}
.one-half,
.three-sixths,
.two-fourths {
width: 48.717948717948715%;
}
.one-third,
.two-sixths {
width: 31.623931623931625%;
}
.four-sixths,
.two-thirds {
width: 65.81196581196582%;
}
.one-fourth {
width: 23.076923076923077%;
}
.three-fourths {
width: 74.35897435897436%;
}
.one-sixth {
width: 14.52991452991453%;
}
.five-sixths {
width: 82.90598290598291%;
}
.first {
clear: both;
margin-left: 0;
}
<div class="one-fourth first box box1">
<h3>SEO</h3>
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box2">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box3">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box4">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth first box box5">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box6">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box7">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
<div class="one-fourth box box8">
<div class="overlay">
<span class="overlayText">SEO</span>
</div>
</div>
If i understand your problem correctly you need to use position:absolute for your .overlay div to position it on top of your .box div.
You can try this:
.box { position: relative}
.overlay{position:absolute;
top:0px;
left:0px}
Do this:
.box {
position:relative;
}
.overlay {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
}