Classic alignment difficulties between two row elements in the html vs css - html

Hello dear stack overflow citizens. I have a boring problem with two elements (watch code snippet below) but unfortunately, I ought to resolve it. I'll be grateful for any help or advice.
I need final result like this
In the circle with background: grey I positioned a relative social media links(.social__icon>img). I can’t load svg files from assets here. You can watch the screenshot with my embarrassing acts:
I don't have enough reputation to embed screenshots, I hope you can watch it somehow.
If not, it should look something like this:
social media link img margin left:12px socila media text-name also realative link img with hover and animation effects
They both needs to work like one in a row
Example
I'm facebook svg icon in the grey ellips 12px-left Facebook
Thats result with
.social__icon {
display: inline-flex; /* Changed */
align-items: center; /* Added */
enter image description here
Active mode:
enter image description here
ol,
ul,
li,
menu {
list-style: none;
}
a {
text-decoration: none;
}
.social__list {
display: flex;
flex-direction: column;
gap: 10px;
}
.social__icon {
display: inline-block;
text-align: center;
width: 26px;
height: 26px;
border-radius: 100%;
background: rgba(196, 196, 196, 0.5);
-webkit-transition: all 0.25s linear;
-moz-transition: all 0.25s linear;
-ms-transition: all 0.25s linear;
-o-transition: all 0.25s linear;
transition: all 0.25s linear;
}
.social__icon img {
vertical-align: middle;
}
.social__icon span {}
.social__icon:active {
background: #4B9200;
color: #4B9200;
}
.social__icon:hover {
animation: shake 500ms ease-in-out forwards;
}
#keyframes shake {
0% {
transform: rotate(2deg);
}
50% {
transform: rotate(-3deg);
}
70% {
transform: rotate(3deg);
}
100% {
transform: rotate(0deg);
}
}
<div class="social">
<ul class="social__list">
<li>
<a class="social__icon" href="https://en-gb.facebook.com" target="_blank" rel="noopener">
<img src="../../assets/icons/social/fb.svg" alt="">
<span>Facebook</span>
</a>
</li>
<li>
<a class="social__icon" href="https://twitter.com" target="_blank" rel="noopener">
<img src="../../assets/icons/social/twtr.svg" alt="">
<span>Twitter</span>
</a>
</li>
<li>
<a class="social__icon" href="https://www.instagram.com" target="_blank" rel="noopener">
<img src="../../assets/icons/social/inst.svg" alt="">
<span>Instagram</span>
</a>
</li>
<li>
<a class="social__icon" href="https://www.youtube.com" target="_blank" rel="noopener">
<img src="../../assets/icons/social/youtube.svg" alt="">
<span>Youtube</span>
</a>
</li>
</ul>
</div>

Some style issues in the image
ol,
ul,
li,
menu {
list-style: none;
}
a {
text-decoration: none;
}
.social__list {
display: flex;
flex-direction: column;
gap: 10px;
}
.social__icon {
display: inline-block;
text-align: center;
-webkit-transition: all 0.25s linear;
-moz-transition: all 0.25s linear;
-ms-transition: all 0.25s linear;
-o-transition: all 0.25s linear;
transition: all 0.25s linear;
}
.social__icon img {
width: 26px;
height: 26px;
vertical-align: middle;
border-radius: 100%;
background: rgba(196, 196, 196, 0.5);
}
.social__icon:active {
background: #4b9200;
color: #4b9200;
}
.social__icon:hover {
animation: shake 500ms ease-in-out forwards;
}
#keyframes shake {
0% {
transform: rotate(2deg);
}
50% {
transform: rotate(-3deg);
}
70% {
transform: rotate(3deg);
}
100% {
transform: rotate(0deg);
}
}
<div class="social">
<ul class="social__list">
<li>
<a
class="social__icon"
href="https://en-gb.facebook.com"
target="_blank"
rel="noopener"
>
<img
src="https://cdn3.iconfinder.com/data/icons/free-social-icons/67/facebook_circle_color-512.png"
alt=""
/>
<span>Facebook</span>
</a>
</li>
<li>
<a
class="social__icon"
href="https://twitter.com"
target="_blank"
rel="noopener"
>
<img
src="https://cdn4.iconfinder.com/data/icons/social-media-icons-the-circle-set/48/twitter_circle-512.png"
alt=""
/>
<span>Twitter</span>
</a>
</li>
<li>
<a
class="social__icon"
href="https://www.instagram.com"
target="_blank"
rel="noopener"
>
<img
src="https://cdn2.iconfinder.com/data/icons/social-media-applications/64/social_media_applications_3-instagram-512.png"
alt=""
/>
<span>Instagram</span>
</a>
</li>
<li>
<a
class="social__icon"
href="https://www.youtube.com"
target="_blank"
rel="noopener"
>
<img
src="https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/395_Youtube_logo-512.png"
alt=""
/>
<span>Youtube</span>
</a>
</li>
</ul>
</div>

Related

Hexagon Grid CSS - All hexagons change size when each of them is clicked

I have 8 hexagons made purely with HTML and CSS and the code is taken from this example. However, I have inserted my own images in them.
Problem:
They all change sizes each time I click any of them.
Functionality:
I am showing different information on the other half of the page corresponding to each of the hexagons when clicked using useState React hook. Would that be the cause?
What I've tried:
The code is using %in CSS so, I changed it to pixels thinking it's a responsiveness issue but that didn't help
I used some other examples too however, that didn't help either
Expected:
When clicked on any hexagon, sizes shouldn't change
My first time posting so hope the structure above is as expected. Any help or tips will be much appreciated. Thanks
#hexGrid {
display: flex;
flex-wrap: wrap;
padding-left:0px;
width: 45%;
overflow: hidden;
font-size: 15px;
list-style-type: none;
}
.hex {
position: relative;
visibility:hidden;
outline:1px solid transparent; /* fix for jagged edges in FF on hover transition */
}
.hex::after{
content:'';
display:block;
padding-bottom: 86.602%; /* = 100 / tan(60) * 1.5 */
}
.hexIn{
position: absolute;
width:96%;
padding-bottom: 110.851%; /* = width / sin(60) */
margin:0 2%;
overflow: hidden;
visibility: hidden;
outline:1px solid transparent; /* fix for jagged edges in FF on hover transition */
-webkit-transform: rotate3d(0,0,1,-60deg) skewY(30deg);
-ms-transform: rotate3d(0,0,1,-60deg) skewY(30deg);
transform: rotate3d(0,0,1,-60deg) skewY(30deg);
}
.hexIn * {
position: absolute;
visibility: visible;
outline:1px solid transparent; /* fix for jagged edges in FF on hover transition */
}
.hexLink {
display:block;
width: 100%;
height: 100%;
text-align: center;
color: #fff;
overflow: hidden;
-webkit-transform: skewY(-30deg) rotate3d(0,0,1,60deg);
-ms-transform: skewY(-30deg) rotate3d(0,0,1,60deg);
transform: skewY(-30deg) rotate3d(0,0,1,60deg);
}
/*** HEX CONTENT **********************************************************************/
.hex img {
left: -100%;
right: -100%;
width: auto;
height: 100%;
-webkit-transform: rotate3d(0,0,0,0deg);
-ms-transform: rotate3d(0,0,0,0deg);
transform: rotate3d(0,0,0,0deg);
}
.hex p {
width: 100%;
padding: 2%;
box-sizing:border-box;
color: #fff;
background-color: #ff7f50;
font-weight: 300;
-webkit-transition: -webkit-transform .2s ease-out, opacity .3s ease-out;
transition: transform .2s ease-out, opacity .3s ease-out;
opacity:0.8;
}
.hex p.cc {
width: 100%;
box-sizing:border-box;
color: #fff;
background-color: #54a29b;
font-weight: 300;
-webkit-transition: -webkit-transform .2s ease-out, opacity .3s ease-out;
transition: transform .2s ease-out, opacity .3s ease-out;
}
.hex h1 {
width:100%;
bottom: 35%;
padding-top:50%;
font-size: 1.25em;
z-index: 1;
color:#000;
-webkit-transform:translate3d(0,-100%,0);
-ms-transform:translate3d(0,-100%,0);
transform:translate3d(0,-100%,0);
}
.hex p {
top: 58%;
padding-bottom:60%;
-webkit-transform:translate3d(0,100%,0);
-ms-transform:translate3d(0,100%,0);
transform:translate3d(0,100%,0);
}
/*** HOVER EFFECT **********************************************************************/
.hexLink h1,
.hexLink:hover p {
-webkit-transform:translate3d(0,0,0);
-ms-transform:translate3d(0,0,0);
transform:translate3d(0,0,0);
}
/*** HEXAGON SIZING AND EVEN ROW INDENTATION *****************************************************************/
#media (min-width:1201px) { /* <- 5-4 hexagons per row */
#hexGrid{
padding-bottom: 4.4%
}
.hex {
width:30%; /* = 100 / 3 */
}
.hex:nth-child(9n+4){ /* first hexagon of even rows */
margin-left: 15%; /* = width of .hex / 2 to indent even rows */
}
}
#media (max-width: 1200px) and (min-width:901px) { /* <- 4-3 hexagons per row */
#hexGrid{
padding-bottom: 5.5%
}
.hex {
width: 25%; /* = 100 / 4 */
}
.hex:nth-child(7n+5){ /* first hexagon of even rows */
margin-left:12.5%; /* = width of .hex / 2 to indent even rows */
}
}
#media (max-width: 900px) and (min-width:601px) { /* <- 3-2 hexagons per row */
#hexGrid{
padding-bottom: 7.4%
}
.hex {
width: 33.333%; /* = 100 / 3 */
}
.hex:nth-child(5n+4){ /* first hexagon of even rows */
margin-left:16.666%; /* = width of .hex / 2 to indent even rows */
}
}
#media (max-width: 600px) { /* <- 2-1 hexagons per row */
#hexGrid{
padding-bottom: 11.2%
}
.hex {
width: 50%; /* = 100 / 3 */
}
.hex:nth-child(3n+3){ /* first hexagon of even rows */
margin-left:25%; /* = width of .hex / 2 to indent even rows */
}
}
#media (max-width: 400px) {
#hexGrid {
font-size: 13px;
}
}
<div id="hexGrid">
<li class="hex">
<div class="hexIn">
<a class="hexLink" onClick={displayText1Content}>
<img src="../../../../assets/images/hex-orange.png" />
<h1>Text1</h1>
<p>Click to learn more</p>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" onClick={displayText2ontent}>
<img src="../../../../assets/images/hex-orange.png" />
<h1>Text2</h1>
<p>Click to learn more</p>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" onClick={displayReportsContent}>
<img src="../../../../assets/images/hex-orange.png" />
<h1>Text3</h1>
<p>Click to learn more</p>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" onClick={displayText4Content}>
<img src="../../../../assets/images/hex-blue2.png" />
<h1>Text4</h1>
<p>Click to learn more</p>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" onClick={displayText5Content}>
<img src="../../../../assets/images/hex-blue2.png" />
<h1>Text5</h1>
<p>Click to learn more</p>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" onClick={displayText6Content}>
<img src="../../../../assets/images/hex-orange.png" />
<h1>Text6</h1>
<p>Click to learn more</p>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" onClick={displayText7Content}>
<img src="../../../../assets/images/hex-orange.png" />
<h1>Text7</h1>
<p>Click to learn more</p>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" onClick={displayText8Content}>
<img src="../../../../assets/images/hex-orange.png" />
<h1>Text8</h1>
<p>Click to learn more</p>
</a>
</div>
</li>
</div>

How do I make effect like this on image hover?

I want to give effect like this on image hover http://mahno.com.ua/en/architecture. Tried this but how to hide image on hover and display name .I have used CSS: On hover show and hide different div's at the same time? but having no luck.
EDIT: Want that effect in this code
<div class="content">
<div class="content-wrap">
<div>
<div>
<h1 class="title">Architecture</h1>
</div>
<!--section-title end-->
<div>
<div>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/6151-fsdgsfg.gif">
</a>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/6923-KUB%207.jpg">
</a>
</div>
<div>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/7093-3.jpg">
</a>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/1562-d.jpg">
</a>
</div>
<div>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/5548-pddf.jpg">
</a>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/1562-d.jpg">
</a>
</div>
<div>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/1586-fdgsfgsdfggsdfgs.jpg">
</a>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/1597-dogs.jpg">
</a>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/6155-Untitled-3.gif">
</a>
</div>
<div>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/3405-klink-mal.jpg">
</a>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/6128-ghrt1.jpg">
</a>
<span class="tim">Kube house</span>
<a href="#">
<img src="images/1555-dsfsdfds.jpg">
</a>
</div>
</div> <!--product-list end-->
</div>
</div>
Sorry, for dirty code...
img {
display: block;
background-color: #fff;
transition: .2s;
}
.nav-ul:hover img {
opacity: 0;
}
a {
color: inherit;
text-decoration: none;
outline: none;
}
.list-unstyled {
padding: 0;
margin: 0;
list-style: none;
}
* {
box-sizing: border-box;
}
.nav-li {
position: relative;
}
.nav .tim {
opacity: 0;
position: absolute;
left: 6px;
bottom: 0;
transition: .5s;
}
.nav:hover .tim {
opacity: 1;
}
.nav .nav-ul {
padding: 0;
margin: 0;
list-style: none;
text-align: center;
}
.nav .nav-li {
display: inline-block;
font-size: 1em;
}
.nav .nav-li a {
position: relative;
display: block;
margin: 0 2px;
text-transform: uppercase;
overflow: hidden;
}
.nav .nav-li a:before {
box-sizing: border-box;
transform: translateX(100%);
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 2px;
border-bottom: 2px solid transparent;
border-left: 2px solid transparent;
}
.nav .nav-li a:after {
box-sizing: border-box;
transform: translateX(-100%);
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 2px;
border-top: 2px solid transparent;
border-right: 2px solid transparent;
}
.nav .nav-li a:hover {
color: inherit;
text-decoration: none;
}
.nav .nav-li a:hover:before {
transition: .2s transform linear, .2s height linear .2s;
transform: translateX(0);
height: 100%;
border-color: #1fbfac;
}
.nav .nav-li a:hover:after {
transition: .2s transform linear .4s, .2s height linear .6s;
transform: translateX(0);
height: 100%;
border-color: #1fbfac;
}
<div class="nav">
<div class="nav-ul">
<div class="nav-li">
<span class="tim">Kube house</span>
<a href="#">
<img src="http://beerhold.it/300/300">
</a>
</div>
</div>
<div class="nav-ul">
<div class="nav-li">
<span class="tim">Kube house</span>
<a href="#">
<img src="http://beerhold.it/300/300">
</a>
</div>
</div>
<div class="nav-ul">
<div class="nav-li">
<span class="tim">Kube house</span>
<a href="#">
<img src="http://beerhold.it/300/300">
</a>
</div>
</div>
</div>
To copy this effect you can inspect the element .no-touch .product-list .item a:hover on aforementioned site. There are span.title inside, and opacity for this element is changed from 0 to 1 on parent hovering. I can provide codepen for this, but after inspecting requested effect you will see that it is pretty self-explanatory.
For example:
.feature {
height:250px;
width:250px;
background:url('http://placehold.it/250x250');
position:relative;
}
.feature:hover {
background:red;
}
.feature:hover .title {
opacity: 1;
}
.title {
width:100%;
text-align:center;
position:absolute;
top:50%;
left:50%;
transform:translate(-50%, -50%);
display:block;
opacity:0;
}
<div class="feature">
<div class="title">Example Title</div>
</div>
Try this. It may help you.
HTML
<ul class="demo-3">
<li>
<figure>
<img src="https://lh6.ggpht.com/0d53JZiYmsBBhHv07OUeovHruEg0WvFdbhmy4iK1hyEifm6qV5dcEopPwq-Dz8eBWsxP=h900" alt="" width="100%"/>
<figcaption>
<h2>This is a cool title!</h2>
<p>A fish is any member of a paraphyletic group of organisms that consist of all gill-bearing aquatic craniate animals that lack limbs with digits.</p>
</figcaption>
</figure>
</li>
</ul>
CSS:
.demo-3 {
position:relative;
width:300px;
height:200px;
overflow:hidden;
float:left;
margin-right:20px
}
.demo-3 figure {
margin:0;
padding:0;
position:relative;
cursor:pointer;
margin-left:-50px
}
.demo-3 figure img {
display:block;
position:relative;
z-index:10;
margin:-15px 0
}
.demo-3 figure figcaption {
display:block;
position:absolute;
z-index:5;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box
}
.demo-3 figure h2 {
font-family:'Lato';
color:#fff;
font-size:20px;
text-align:left
}
.demo-3 figure p {
display:block;
font-family:'Lato';
font-size:12px;
line-height:18px;
margin:0;
color:#fff;
text-align:left
}
.demo-3 figure figcaption {
top:0;
left:0;
width:100%;
height:100%;
padding:29px 44px;
background-color:rgba(26,76,110,0.5);
text-align:center;
backface-visibility:hidden;
-webkit-transform:rotateY(-180deg);
-moz-transform:rotateY(-180deg);
transform:rotateY(-180deg);
-webkit-transition:all .5s;
-moz-transition:all .5s;
transition:all .5s
}
.demo-3 figure img {
backface-visibility:hidden;
-webkit-transition:all .5s;
-moz-transition:all .5s;
transition:all .5s
}
.demo-3 figure:hover img,figure.hover img {
-webkit-transform:rotateY(180deg);
-moz-transform:rotateY(180deg);
transform:rotateY(180deg)
}
.demo-3 figure:hover figcaption,figure.hover figcaption {
-webkit-transform:rotateY(0);
-moz-transform:rotateY(0);
transform:rotateY(0)
}
Run Code

Scale image and add text overlay on hover

I have a group of images displayed on beneath the other, made to look as though they're one full image on first glance, but which break up on hover as the images shrink on hover.
Each of these images links to a different page on my website though, so I'd also like to add some text to the centre of each image on hover.
I've found lots of suggestions as to how to add the text, but none that don't break the image transition effect that I already have in place.
<style>
.image4 {
-webkit-transition: all 0.7s ease;
transition: all 0.7s ease;
}
.image4:hover {
-webkit-transform:scale(0.7);
transform:scale(0.7);
}
</style>
<a>
<A HREF="http://philandkaren.weebly.com/the-day.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage1.jpeg">
</a>
<a>
<A HREF="http://philandkaren.weebly.com/getting-there.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage2.jpeg">
</a>
<a>
<A HREF="http://philandkaren.weebly.com/local-information.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage3.jpeg">
</a>
<a>
<A HREF="http://philandkaren.weebly.com/accommodation.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage4.jpeg">
</a>
<a>
<A HREF="http://philandkaren.weebly.com/taxis.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage5.jpeg">
</a>
<a>
<A HREF="http://philandkaren.weebly.com/honeymoon-fund.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage6.jpeg">
</a>
<a>
<A HREF="http://philandkaren.weebly.com/faqs.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage7.jpeg">
</a>
<a>
<A HREF="http://philandkaren.weebly.com/rsvp.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage8.jpeg">
</a>
Does anyone know how I might achieve the text overlay that I'm looking for, whilst retaining the image scaling? Each image is 750 by 128.
Use the link as a wrapper, with position:relative and add your text content to an absolutely positioned overlay.
Then move the hover trigger to the parent link:
a:hover .image4 {
-webkit-transform: scale(0.7);
transform: scale(0.7);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.image4 {
-webkit-transition: all 0.7s ease;
transition: all 0.7s ease;
display: block;
}
a:hover .image4 {
-webkit-transform: scale(0.7);
transform: scale(0.7);
}
a {
margin: 1em;
display: inline-block;
position: relative;
text-decoration: none;
color: white;
}
a .overlay {
text-decoration: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity .7s ease;
}
a:hover .overlay {
opacity: 1;
}
<a HREF="http://philandkaren.weebly.com/faqs.html">
<img class="image4" src="http://philandkaren.weebly.com/files/theme/Homepage7.jpeg">
<div class="overlay">
<h1>OVERLAY TEXT</h1>
</div>
</a>

I want to merge two cells together in the proposed html layout

I'm using this layout and as you can see there is a section with 8 pictures on the bottom of the page - each of them is a hyperlink to the bigger image. It works pretty neat, esp. when you resize the page to smaller size, then the 4 cells becomes 2 and it looks like this. I want to change it a little, so that two first pictures are merged together, so the layout could look like this, and when the user resizes it, it would show him a proper layout like this. So far the html code for that specific part of the page looks like this:
<section class="screenshots" id="screenshots">
<div class="container-fluid">
<div class="row">
<ul class="grid">
<li>
<figure>
<img src="img/02-screenshot.jpg" alt="Screenshot 01">
<figcaption>
<div class="caption-content">
<a href="img/large/02.jpg" class="single_image">
<i class="fa fa-search"></i><br>
<p>User Centric Design</p>
</a>
</div>
</figcaption>
</figure>
</li>
<li>
<figure>
<img src="img/03-screenshot.jpg" alt="Screenshot 01">
<figcaption>
<div class="caption-content">
<a href="img/large/03.jpg" class="single_image">
<i class="fa fa-search"></i><br>
<p>Responsive and Adaptive</p>
</a>
</div>
</figcaption>
</figure>
</li>
<li>
<figure>
<img src="img/04-screenshot.jpg" alt="Screenshot 01">
<figcaption>
<div class="caption-content">
<a href="img/large/04.jpg" class="single_image">
<i class="fa fa-search"></i><br>
<p>Absolutely Free</p>
</a>
</div>
</figcaption>
</figure>
</li>
</ul>
</div>
<div class="row">
<ul class="grid">
<li>
<figure>
<img src="img/06-screenshot.jpg" alt="Screenshot 01">
<figcaption>
<div class="caption-content">
<a href="img/large/06.jpg" class="single_image">
<i class="fa fa-search"></i><br>
<p>Exclusive to Codrops</p>
</a>
</div>
</figcaption>
</figure>
</li>
<li>
<figure>
<img src="img/07-screenshot.jpg" alt="Screenshot 01">
<figcaption>
<div class="caption-content">
<a href="img/large/07.jpg" class="single_image">
<i class="fa fa-search"></i><br>
<p>Made with Love</p>
</a>
</div>
</figcaption>
</figure>
</li>
<li>
<figure>
<img src="img/08-screenshot.jpg" alt="Screenshot 01">
<figcaption>
<div class="caption-content">
<a href="img/large/08.jpg" class="single_image">
<i class="fa fa-search"></i><br>
<p>In Sydney, Australia</p>
</a>
</div>
</figcaption>
</figure>
</li>
</ul>
</div>
</div>
</section>
and the css code looks like this:
/* ==========================================================================
Screenshots Intro
========================================================================== */
.screenshots-intro {
padding: 170px 0 100px 0;
background-color: #f6f7f9;
}
.screenshots-intro h1 {
margin-bottom: 20px;
color: #24374b;
font-weight: 400;
font-size: 22px;
}
.screenshots-intro p {
margin-bottom: 25px;
color: #778899;
}
/* ==========================================================================
Screenshots
========================================================================== */
.screenshots ul {
margin: 0;
padding: 0;
width: 100%;
}
.screenshots ul li {
float: left;
min-height: 100%;
width: 25%;
background-color: #000;
list-style: none;
}
.screenshots figure {
position: relative;
overflow: hidden;
}
.screenshots figure img {
width: 100%;
height: 100%;
-webkit-transition: all 300ms ease-in-out;
transition: all 300ms ease-in-out;
}
.screenshots figure:hover img, .screenshots figure:focus img {
-webkit-transform: scale(1.1);
-ms-transform: scale(1.1);
transform: scale(1.1);
}
.screenshots figcaption {
position: absolute;
top: 0;
left: 0;
padding: 25% 0;
width: 100%;
height: 100%;
background-color: rgba(63, 97, 132, 0.85);
text-align: center;
font-size: 15px;
opacity: 0;
-webkit-transition: all 300ms ease-in-out;
transition: all 300ms ease-in-out;
}
.screenshots figcaption a {
color: #fff
}
.screenshots figcaption a:hover, .screenshots figcaption a:focus {
color: #73d0da
}
.screenshots figure:hover figcaption, .screenshots figure:focus figcaption {
opacity: 1
}
.visible {
opacity: 1
}
.screenshots figure.cs-hover figcaption {
opacity: 1
}
.screenshots figcaption i {
font-size: 35px
}
.screenshots figcaption p {
margin-bottom: 0;
text-transform: uppercase;
font-weight: 400;
}
.screenshots figcaption .caption-content {
position: absolute;
top: 50%;
left: 50%;
margin-top: -40px;
margin-left: -100px;
width: 200px;
-webkit-transform: translate(0px, 15px);
-ms-transform: translate(0px, 15px);
transform: translate(0px, 15px);
-webkit-transition: all 300ms ease-in-out;
transition: all 300ms ease-in-out;
}
.screenshots figure:hover figcaption .caption-content, .screenshots figure:focus figcaption .caption-content {
-webkit-transform: translate(0px, 0px);
-ms-transform: translate(0px, 0px);
transform: translate(0px, 0px);
}
I know it's a lot of code, but maybe anyone of you have the idea of how to change this particular part of the layout to have it as I included in the pictures? Thanks.
This is the updated answer.
I am attaching the code and jsfiddle link with it.
Just replace the src of the images with yours to see the results.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<style type="text/css">
.container {
width: 100%;
margin: 0 auto;
}
img {
max-width: 100%;
}
/* this css is just for understanding */
.a {
background-color: red;
}
.b {
background-color: green;
}
.c {
background-color: blue;
}
.d {
background-color: black;
}
/* this css is just for understanding */
/* this is the logic to change the positions of image */
#media (min-width: 320px) {
.a,
.b,
.c,
.d {
width: 100%;
float: left;
}
}
#media (min-width: 768px) {
.a,
.b,
.c,
.d {
width: 50%;
float: left;
}
}
</style>
<body>
<div class="container">
<div class="a">
<img src="img/1.png" height="222" width="581">
</div>
<div class="b">
<img src="img/2.jpg" height="222" width="581">
</div>
<div class="c">
<img src="img/3.jpg" height="222" width="581">
</div>
<div class="d">
<img src="img/4.png" height="222" width="581">
</div>
</div>
</body>
</html>
this is the jsfiddle link

Issue with hover opacity and headers

I want my website to have the same effect this website has: Trask Industries
When the upper right image is hovered the text appears and yellow covers the image.
This is the effect I am failing to recreate in CSS and Html, using headers and hover opacity. In my attempts the headers become opaque rather than standing out like on that site. I also don't know how to make the headers appear and disappear on hover.
Here is the jsfiddle of my attempt.
.content1:hover, .content2:hover, .content3:hover, .content4:hover, .content5:hover, .content6:hover {
color: black;
opacity: 0.30;
transition: .2s;
webkit-transition: .2s;
-webkit-transition: all 500ms ease;
}
You must wrap the h1 and h2 in a div, and you would animate that div in css.
I also added a same class for the contents.
Here is an updated fiddle:
http://jsfiddle.net/bzm6T/2/
Basically, this is the updated code:
Code:
.contents:hover > div {
color: black;
opacity: 1;
}
.contents div {
opacity: 0;
display: block;
width: 100%; height: 100%;
background: rgba(255,255,255,0.3);
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
<div class="container">
<a href="articleF.html" class="contents content1">
<div>
<h1>The Low Stakes of Modern life</h1>
<h2>Default 1Default 1Default 1Default 1Default 1Default 1</h2>
</div>
</a>
<a href="articleA1.html" class="contents content2">
<div>
<h1>AARON SWARTZ</h1>
<h2>Cats Can Puuuuur</h2>
</div>
</a>
<a href="articleA2.html" class="contents content3">
<div>
<h1>JOBILLY BOOP</h1>
<h2>Cats Can Puuuuur</h2>
</div>
</a>
<a href="articleD.html" class="contents content4">
<div>
<h1>Content4</h1>
<h2>Cats Can Puuuuur</h2>
</div>
</a>
<a href="articleK1.html" class="contents content5">
<div>
<h1>Content5</h1>
<h2>Cats Can Puuuuur</h2>
</div>
</a>
<a href="articleK1.html" class="contents Content6">
<div>
<h1>Content6</h1>
<h2>Cats Can Puuuuur</h2>
</div>
</a>
</div>
A slightly different approach, but basically the same with CSS transition: FIDDLE
.holder {
width: auto;
margin: 10px auto;
border: 1px solid black;
overflow: hidden;
}
.leftdiv {
float: left;
background-color: blue;
height: 100%;
color: white;
}
.picdiv {
float: right;
background-color: orange;
}
.picdiv img {
opacity: 1;
transition: opacity 1s ease-in-out;
}
.picdiv img:hover {
opacity: 0;
}