I used clip-path to create a circle in which my image can zoom out and a filter gets applied to it.
But for some reason straight lines are visible during the hover transition.
Wierd lines around image
.u-center-text {
text-align: center !important;
}
.u-margin-bottom-small {
margin-bottom: 1.5rem !important;
}
.u-margin-bottom-medium {
margin-bottom: 4rem !important;
}
.u-margin-bottom-big {
margin-bottom: 8rem !important;
}
.u-margin-top-big {
margin-top: 8rem !important;
}
.u-margin-top-huge {
margin-top: 10rem !important;
}
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
font-size: 62.5%;
}
body {
padding: 3rem;
font-family: "Lato", sans-serif;
font-weight: 400;
line-height: 1.7;
color: #777;
box-sizing: border-box;
}
.story {
width: 75%;
margin: 0 auto;
box-shadow: 0 3rem 6rem rgba(0, 0, 0, 0.1);
background-color: #fff;
border-radius: 3px;
padding: 6rem;
padding-left: 9rem;
font-size: 1.6rem;
transform: skewX(-12deg);
margin-bottom: 10rem;
}
.story__shape {
width: 15rem;
height: 15rem;
float: left;
-webkit-shape-outside: circle(50% at 50% 50%);
shape-outside: circle(50% at 50% 50%);
-webkit-clip-path: circle(50% at 50% 50%);
clip-path: circle(50% at 50% 50%);
transform: translateX(-3rem) skewX(12deg);
}
.story__img {
height: 100%;
transform: scale(2.5);
transition: all 0.4s;
overflow: hidden;
}
.story__text {
transform: skewX(12deg);
}
.story__caption {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, 20%);
color: #fff;
font-size: 1.7rem;
text-align: center;
opacity: 0;
transition: all 0.4s;
}
.story:hover .story__caption {
opacity: 1;
transform: translate(-50%, -50%);
}
.story:hover .story__img {
transform: scale(2);
filter: blur(3px) brightness(80%);
}
<div class="row">
<div class="story">
<figure class="story__shape">
<img src="https://images.unsplash.com/photo-1595169269488-02a14b7197c1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9" alt="Person on a tour" class="story__img">
<figcaption class="story__caption">Mary Smith</figcaption>
</figure>
<div class="story__text">
<h3 class="heading-tertiary u-margin-bottom-small">I had the best week ever with my family</h3>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam, ipsum sapiente aspernatur libero repellat quis consequatur ducimus quam nisi exercitationem omnis earum qui. Aperiam, ipsum sapiente aspernatur libero repellat quis consequatur ducimus
quam nisi exercitationem omnis earum qui.
</p>
</div>
</div>
</div>
Add overflow:hidden to .story__shape
.u-center-text {
text-align: center !important;
}
.u-margin-bottom-small {
margin-bottom: 1.5rem !important;
}
.u-margin-bottom-medium {
margin-bottom: 4rem !important;
}
.u-margin-bottom-big {
margin-bottom: 8rem !important;
}
.u-margin-top-big {
margin-top: 8rem !important;
}
.u-margin-top-huge {
margin-top: 10rem !important;
}
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
font-size: 62.5%;
}
body {
padding: 3rem;
font-family: "Lato", sans-serif;
font-weight: 400;
line-height: 1.7;
color: #777;
box-sizing: border-box;
}
.story {
width: 75%;
margin: 0 auto;
box-shadow: 0 3rem 6rem rgba(0, 0, 0, 0.1);
background-color: #fff;
border-radius: 3px;
padding: 6rem;
padding-left: 9rem;
font-size: 1.6rem;
transform: skewX(-12deg);
margin-bottom: 10rem;
}
.story__shape {
width: 15rem;
height: 15rem;
float: left;
-webkit-shape-outside: circle(50% at 50% 50%);
shape-outside: circle(50% at 50% 50%);
-webkit-clip-path: circle(50% at 50% 50%);
clip-path: circle(50% at 50% 50%);
transform: translateX(-3rem) skewX(12deg);
overflow:hidden;
}
.story__img {
height: 100%;
transform: scale(2.5);
transition: all 0.4s;
overflow: hidden;
}
.story__text {
transform: skewX(12deg);
}
.story__caption {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, 20%);
color: #fff;
font-size: 1.7rem;
text-align: center;
opacity: 0;
transition: all 0.4s;
}
.story:hover .story__caption {
opacity: 1;
transform: translate(-50%, -50%);
}
.story:hover .story__img {
transform: scale(2);
filter: blur(3px) brightness(80%);
}
<div class="row">
<div class="story">
<figure class="story__shape">
<img src="https://images.unsplash.com/photo-1595169269488-02a14b7197c1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9" alt="Person on a tour" class="story__img">
<figcaption class="story__caption">Mary Smith</figcaption>
</figure>
<div class="story__text">
<h3 class="heading-tertiary u-margin-bottom-small">I had the best week ever with my family</h3>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam, ipsum sapiente aspernatur libero repellat quis consequatur ducimus quam nisi exercitationem omnis earum qui. Aperiam, ipsum sapiente aspernatur libero repellat quis consequatur ducimus
quam nisi exercitationem omnis earum qui.
</p>
</div>
</div>
</div>
Related
I can not get the image area to take full size on a smaller viewport (max-width: 768px) when chaging the flex-item to column
Even under min-width a max-width set up on 100%, the image still shows on on a 760px by a mere 49.59px
I also made sure this would be an overflow issue, the viewport is set to a 100% anyways.
Here is my html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="./css/styles.css">
<link rel="stylesheet" type="text/css" href="./css/blog-styles.css">
<script
src="https://code.jquery.com/jquery-3.6.0.js"
integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk="
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Lato:wght#300;400&family=Open+Sans&family=Poppins&family=Raleway:wght#600&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/c8e4d183c2.js" crossorigin="anonymous"></script>
<title>Blog</title>
<script type='text/javascript' src=js/templates.js></script>
</head>
<body>
<!-- Main Menu Section-->
<my-menu></my-menu>
<!-- about section-->
<section>
<div class="blog-post__cards">
<div class="blog-post">
<div class="blog-post__img">
<img src="/img/post-photo.jpg" alt="">
</div>
<div class="blog-post__info">
<div class="blog-post__date">
<span>Sunday</span>
<spa>August 18 2021</spa>
</div>
<h1 class="blog-post__title">Blog Post Title</h1>
<p class="blog-post__text">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto laudantium, reiciendis ut dolore voluptatibus consequatur quam impedit eligendi sapiente voluptate, molestiae libero quae magni quia. Minima ipsa velit eius aut!
</p>
Read More
</div>
</div>
<div class="blog-post">
<div class="blog-post__img">
<img src="/img/post-photo.jpg" alt="">
</div>
<div class="blog-post__info">
<div class="blog-post__date">
<span>Sunday</span>
<spa>August 18 2021</spa>
</div>
<h1 class="blog-post__title">Blog Post Title</h1>
<p class="blog-post__text">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto laudantium, reiciendis ut dolore voluptatibus consequatur quam impedit eligendi sapiente voluptate, molestiae libero quae magni quia. Minima ipsa velit eius aut!
</p>
Read More
</div>
</div>
<div class="blog-post">
<div class="blog-post__img">
<img src="/img/post-photo.jpg" alt="">
</div>
<div class="blog-post__info">
<div class="blog-post__date">
<span>Sunday</span>
<spa>August 18 2021</spa>
</div>
<h1 class="blog-post__title">Blog Post Title</h1>
<p class="blog-post__text">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto laudantium, reiciendis ut dolore voluptatibus consequatur quam impedit eligendi sapiente voluptate, molestiae libero quae magni quia. Minima ipsa velit eius aut!
</p>
Read More
</div>
</div>
</div>
</section>
<!-- Main Footer Section-->
<my-footer></my-footer>
</body>
And here I share the corresponding CSS
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/*html {
font-family: "Roboto", sans-serif;
font-size: 10px;
}
*/
img {
width: 100%;
}
section {
font-family: "lato", sans-serif;
font-size: 10px;
width: 100%;
height: 10vp;
display: flex;
align-items: flex-start;
justify-content: space-evenly;
background-color: #eee;
padding: 0 15px;
overflow: scroll;
}
.blog-post__cards {
width: 100%;
padding: 5em;
display: flex;
align-content: space-around;
align-items: flex-start;
flex-direction: column;
gap: 10em;
transform: scale(0.95);
}
.blog-post {
width: 850px;
height: 350px;
max-width: 98em;
padding: 5em;
background-color: #fff;
box-shadow: 0 1.4em 8em rgba(0, 0, 0, 0.2);
display: flex;
align-items: center;
border-radius: 0.8em;
}
.blog-post__img {
min-width: 35em;
max-width: 35em;
height: 30em;
transform: translateX(-8em);
position: relative;
}
.blog-post__img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
border-radius: 0.8em;
}
.blog-post__img::before {
content: "";
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: linear-gradient(
to right,
rgba(79, 172, 254, 0.8),
rgba(0, 242, 254, 0.8)
);
box-shadow: 0.5em 0.5em 3em 1px rgba(0, 0, 0, 0.5em);
border-radius: 0.8em;
}
.blog-post__date span {
display: block;
color: rgba(0, 0, 0, 0.5);
font-size: 2em;
font-weight: 600;
margin: 0.2em 0;
}
.blog-post__title {
font-size: 2.5em;
margin: .8em 0 1em;
text-transform: uppercase;
color: #4facfe;
}
.blog-post__text {
margin-bottom: 3em;
font-size: 1.4em;
color: rgba(0, 0, 0, 0.7);
}
.blog-post__cta {
display: inline-block;
padding: 1.2em 3em;
margin-top: 0.5em;
letter-spacing: 1px;
text-transform: uppercase;
font-size: 1.2em;
color: #fff;
background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
border-radius: 0.8em;
text-decoration: none;
float: right;
}
.blog-post__cta:hover {
background-image: linear-gradient(to right, #00f2fe 0%, #4facfe 100%);
}
#media screen and (max-width: 1068px) {
.blog-post {
max-width: 80em;
}
.blog-post__img {
min-width: 30em;
max-width: 30em;
}
}
#media screen and (max-width: 868px) {
.blog-post {
max-width: 70em;
}
}
#media screen and (max-width: 768px) {
.blog-post {
padding: 2.5em;
flex-direction: column;
}
.blog-post__img {
min-width: 100%;
max-width: 100%;
transform: translate(0, -4em);
}
}
Thank you so much for taking a looking a look into this! I am working as much as I can with flex items so any feedback that could be applied to this project would be highly appreciated.
Thank you!
Sometimes it's difficult to try and replicate an issue in Stack Overflow without an editable example. However, I pasted parts of your code into the editor to try and replicate. Are you wanting the image to expand to the entire width of the viewport at your mobile breakpoint?
Inside the mobile styles, I removed a lot of padding and the transform rules that were set on the parent containers, so it may be a combination of all/some of those rules.
#media screen and (max-width: 768px) {
section {
width: 100%;
}
.blog-post {
padding: 0;
flex-direction: column;
height: unset;
max-width: 100%;
}
.blog-post__cards {
transform: scale(1);
}
.blog-post__cards{
padding: 0;
}
.blog-post__img {
min-width: 100%;
max-width: 100%;
width: 100%;
transform: translate(0, -4em);
}
.blog-post__info {
padding: 0 1rem 2rem;
}
}
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/*html {
font-family: "Roboto", sans-serif;
font-size: 10px;
}
*/
img {
width: 100%;
}
section {
font-family: "lato", sans-serif;
font-size: 10px;
width: 100%;
height: 10vp;
display: flex;
align-items: flex-start;
justify-content: space-evenly;
background-color: #eee;
padding: 0 15px;
overflow: scroll;
}
.blog-post__cards {
width: 100%;
padding: 5em;
display: flex;
align-content: space-around;
align-items: flex-start;
flex-direction: column;
gap: 10em;
transform: scale(0.95);
}
.blog-post {
width: 850px;
height: 350px;
max-width: 98em;
padding: 5em;
background-color: #fff;
box-shadow: 0 1.4em 8em rgba(0, 0, 0, 0.2);
display: flex;
align-items: center;
border-radius: 0.8em;
}
.blog-post__img {
min-width: 35em;
max-width: 35em;
height: 30em;
transform: translateX(-8em);
position: relative;
}
.blog-post__img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
border-radius: 0.8em;
}
.blog-post__img::before {
content: "";
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: linear-gradient(
to right,
rgba(79, 172, 254, 0.8),
rgba(0, 242, 254, 0.8)
);
box-shadow: 0.5em 0.5em 3em 1px rgba(0, 0, 0, 0.5em);
border-radius: 0.8em;
}
.blog-post__date span {
display: block;
color: rgba(0, 0, 0, 0.5);
font-size: 2em;
font-weight: 600;
margin: 0.2em 0;
}
.blog-post__title {
font-size: 2.5em;
margin: .8em 0 1em;
text-transform: uppercase;
color: #4facfe;
}
.blog-post__text {
margin-bottom: 3em;
font-size: 1.4em;
color: rgba(0, 0, 0, 0.7);
}
.blog-post__cta {
display: inline-block;
padding: 1.2em 3em;
margin-top: 0.5em;
letter-spacing: 1px;
text-transform: uppercase;
font-size: 1.2em;
color: #fff;
background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
border-radius: 0.8em;
text-decoration: none;
float: right;
}
.blog-post__cta:hover {
background-image: linear-gradient(to right, #00f2fe 0%, #4facfe 100%);
}
#media screen and (max-width: 1068px) {
.blog-post {
max-width: 80em;
}
.blog-post__img {
min-width: 30em;
max-width: 30em;
}
}
#media screen and (max-width: 868px) {
.blog-post {
max-width: 70em;
}
}
#media screen and (max-width: 768px) {
section {
width: 100%;
}
.blog-post {
padding: 0;
flex-direction: column;
height: unset;
max-width: 100%;
}
.blog-post__cards {
transform: scale(1);
}
.blog-post__cards{
padding: 0;
}
.blog-post__img {
min-width: 100%;
max-width: 100%;
width: 100%;
transform: translate(0, -4em);
}
.blog-post__info {
padding: 0 1rem 2rem;
}
}
<section>
<div class="blog-post__cards">
<div class="blog-post">
<div class="blog-post__img">
<img src="https://imagecdn.app/v1/images/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1525923838299-2312b60f6d69?width=800&height=600" alt="">
</div>
<div class="blog-post__info">
<div class="blog-post__date">
<span>Sunday</span>
<span>August 18 2021</span>
</div>
<h1 class="blog-post__title">Blog Post Title</h1>
<p class="blog-post__text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto laudantium, reiciendis ut dolore voluptatibus consequatur quam impedit eligendi sapiente voluptate, molestiae libero quae magni quia. Minima ipsa velit eius aut!</p>
Read More
</div>
</div>
</div>
</section>
There's some awkward vertical line glitch apparently due to filter property(applied on image's hover state) while hovering on a image in chrome(It works fine in mozilla firefox). I have searched on the web but all I could find are kind of similar glitches/bugs or whatever while using backdrop-filter property. So a specific explanation or workaround to these glitch/bug/rendering problem due to this filter property in css would be really nice.
Here's my html code:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Lato';
font-weight: 400;
line-height: 1.7;
padding: 3rem;
color: #777;
}
.header-tertiary {
font-size: 1.6rem;
font-weight: 700;
text-transform: uppercase;
}
.row {
max-width: 114rem;
margin: 0 auto;
}
.story {
width: 75%;
margin: 0 auto;
background-color: #fff;
border-radius: 3px;
box-shadow: 0 3rem 6rem rgba(0, 0, 0, 0.1);
padding: 6rem;
padding-left: 9rem;
font-size: 1.6rem;
transform: skewX(-12deg);
}
.story__shape {
width: 15rem;
height: 15rem;
float: left;
shape-outside: circle(50% at 50% 50%);
clip-path: circle(50% at 50% 50%);
transform: translateX(-3rem) skewX(12deg);
position: relative;
}
.story__img {
height: 100%;
transform: translateX(-3rem) scale(1.4);
transition: all .5s;
}
.story-text {
transform: skewX(12deg);
}
.story__caption {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, 30%);
color: #fff;
text-align: center;
opacity: 0;
transition: all .5s ease;
}
.story:hover .story__caption {
opacity: 1;
transform: translate(-50%, -50%);
}
.story:hover .story__img {
filter: blur(2px) brightness(80%);
-webkit-filter: blur(2px) brightness(80%);
transform: translateX(-3rem) scale(1);
}
<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="row">
<div class="story">
<figure class="story__shape">
<img class="story__img" src="https://images.unsplash.com/photo-1612306055306-e72bd105ad3d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1225&q=80" alt="story image">
<figcaption class="story__caption">
Mary Smith
</figcaption>
</figure>
<div class="story-text">
<h3 class="header-tertiary u-margin-bottom-small">
I had the best week ever with my family
</h3>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Dolorem doloribus voluptatem nisi vel hic suscipit repellendus eum, sed earum placeat quaerat, laboriosam dolores atque ratione odio quidem reprehenderit ea ab. Dolor provident tempora nobis quaerat
consequatur sequi alias illum veritatis.
</p>
</div>
</div>
</div>
</body>
</html>
Note: I have not made my code responsive so please view on full page.
I create a story section which work perfectly. But it have a shaking issue when the section is hovered. I couldn't manage to get rid of that.
.heading-tertiary {
font-size: 1.4rem;
font-weight: 700;
text-transform: uppercase;
}
.u-center-text {
text-align: center !important; }
.u-margin-bottom-8 {
margin-bottom: 8rem; }
.story {
width: 75%;
margin: 0 auto;
box-shadow: 0 3rem 6rem rgba(0, 0, 0, 0.1);
background-color: white;
border-radius: 3px;
padding: 3rem;
padding-top: 4rem;
padding-bottom: 5rem;
font-size: 1.2rem;
transform: skewX(-12deg); }
.story > * {
transform: skewX(12deg); }
.story__shape {
width: 15rem;
height: 15rem;
float: left;
-webkit-shape-outside: circle(64% at 50% 50%);
shape-outside: circle(64% at 50% 50%);
-webkit-clip-path: circle(38% at 50% 50%);
clip-path: circle(38% at 50% 50%);
transform: translateY(-3rem) skewX(12deg);
position: relative; }
.story__img {
height: 100%; }
.story__text {
transform: skewX(12deg); }
.story__caption {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, 20%);
color: white;
text-transform: uppercase;
font-size: 1.6rem;
text-align: center;
opacity: 0;
transition: all 0.5s;
backface-visibility: hidden; }
.story:hover .story__caption {
opacity: 1;
transform: translate(-50%, -50%); }
.row {
max-width: 114rem;
margin: 0 auto;
margin-bottom: 8rem;
padding: 0 5rem 0 5rem; }
.row:last-child {
margin-bottom: 0; }
.row::after {
content: "";
display: table;
clear: both; }
.section-stories {
padding: 5rem 0;
background-color: #f7f7f7; }
<section class="section-stories">
<div class="row">
<div class="story">
<figure class="story__shape">
<img src="https://i.imgur.com/FJZHe8T.jpg" alt="Person on a tour" class="story__img">
<figcaption class="story__caption">NAME</figcaption>
</figure>
<div class="story__text">
<h3 class="heading-tertiary .u-margin-bottom-8">Heading Heading Heading</h3>
<p>
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Atque aperiam, molestias ut, repudiandae, nobis quidem illum explicabo delectus ullam officiis voluptate aut sit quisquam ab id. Repellendus.
</p>
</div>
</div>
</div>
</section>
I remove all the transition property but also didn't work. Even I need those transition properties so I just can't remove them like that. Is there any fix? Here is jsfiddle link in case you need.
This question already has answers here:
What elements can be contained within a <a> tag?
(6 answers)
Closed 3 years ago.
I'm trying to create a card for a website I'm pulling together. On hover, some text slides into view (I've used :hover combined with max-height). To make the whole card clickable, I tried to change a <div> to <a>, I added display:block.
I'm surprised that the behaviour is different - I expected them to be the same.
Two questions:
How do I get the right behaviour - simply making the card clickable without JavaScript.
What is the underlying issue that I've missed?
This version has the <div>:
.card {
background: yellow;
border-radius: .5em;
height: 15em;
position: relative;
overflow: hidden;
transition: all 1s ease-in-out;
}
.card:hover img {
transform: scale(1.1);
}
.card:hover .card-slider {
max-height: 7em;
}
.card-content {
position: absolute;
bottom: 0;
display: block;
}
.card-slider {
transition: all 1s ease-in-out;
max-height: 0;
overflow: hidden;
}
.card h1 {
background: rgba(0, 0, 0, 0.1);
color: white;
}
.card img {
transition: all 1s ease-in-out;
position: relative;
width: 100%;
height: 100%;
object-fit: cover;
}
.card .meta-cat {
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.1);
text-transform: uppercase;
}
.card .meta {
display: flex;
margin: 0;
padding: 0;
justify-content: space-between;
}
.meta-author, .meta-date {
list-style: none;
}
<article class="card">
<img src="http://via.placeholder.com/350x200" alt="">
<header class="meta-cat">Lorem.</header>
<div href="#" class="card-content">
<h1>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure, velit.</h1>
<section class="card-slider">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias dignissimos dolor ex in iusto magnam
molestias odit quaerat rem rerum, similique sit sunt totam veritatis vitae voluptate, voluptatum? Amet,
maxime.</p>
<ul class="meta">
<li class="meta-author">WO J Wright</li>
<li class="meta-date">Posted 5 days ago</li>
</ul>
</section>
</div>
</article>
This version changes the <div> to a <a>.
.card {
background: yellow;
border-radius: .5em;
height: 15em;
position: relative;
overflow: hidden;
transition: all 1s ease-in-out;
}
.card:hover img {
transform: scale(1.1);
}
.card:hover .card-slider {
max-height: 7em;
}
.card-content {
position: absolute;
bottom: 0;
display: block;
}
.card-slider {
transition: all 1s ease-in-out;
max-height: 0;
overflow: hidden;
}
.card h1 {
background: rgba(0, 0, 0, 0.1);
color: white;
}
.card img {
transition: all 1s ease-in-out;
position: relative;
width: 100%;
height: 100%;
object-fit: cover;
}
.card .meta-cat {
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.1);
text-transform: uppercase;
}
.card .meta {
display: flex;
margin: 0;
padding: 0;
justify-content: space-between;
}
.meta-author, .meta-date {
list-style: none;
}
<article class="card">
<img src="http://via.placeholder.com/350x200" alt="">
<header class="meta-cat">Lorem.</header>
<a href="#" class="card-content">
<h1>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure, velit.</h1>
<section class="card-slider">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias dignissimos dolor ex in iusto magnam
molestias odit quaerat rem rerum, similique sit sunt totam veritatis vitae voluptate, voluptatum? Amet,
maxime.</p>
<ul class="meta">
<li class="meta-author">WO J Wright</li>
<li class="meta-date">Posted 5 days ago</li>
</ul>
</section>
</a>
</article>
Actually you can have block elements inside <a> tag, as you already said, just replacing the nested <a> tag inside .meta-author with a span, makes your last snipped works.
.card {
background: yellow;
border-radius: .5em;
height: 15em;
position: relative;
overflow: hidden;
transition: all 1s ease-in-out;
}
.card:hover img {
transform: scale(1.1);
}
.card:hover .card-slider {
max-height: 7em;
}
.card-content {
position: absolute;
bottom: 0;
display: block;
}
.card-slider {
transition: all 1s ease-in-out;
max-height: 0;
overflow: hidden;
}
.card h1 {
background: rgba(0, 0, 0, 0.1);
color: white;
}
.card img {
transition: all 1s ease-in-out;
position: relative;
width: 100%;
height: 100%;
object-fit: cover;
}
.card .meta-cat {
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.1);
text-transform: uppercase;
}
.card .meta {
display: flex;
margin: 0;
padding: 0;
justify-content: space-between;
}
.meta-author, .meta-date {
list-style: none;
}
<article class="card">
<img src="http://via.placeholder.com/350x200" alt="">
<header class="meta-cat">Lorem.</header>
<a href="#" class="card-content">
<h1>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iure, velit.</h1>
<section class="card-slider">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Alias dignissimos dolor ex in iusto magnam
molestias odit quaerat rem rerum, similique sit sunt totam veritatis vitae voluptate, voluptatum? Amet,
maxime.</p>
<ul class="meta">
<li class="meta-author"><span>WO J Wright</span></li>
<li class="meta-date">Posted 5 days ago</li>
</ul>
</section>
</a>
</article>
First post using Stackflow, and super excited to be starting off on my web development career, I am using Foundation 6 to build out my first website and was hoping someone could point out some key aspects of my code that would allow it to become more responsive.. Any help would be greatly appreciated as I am new to all of this!
Thanks!
/* Left Header Block */
.header-left-block {
background-image: url('../img/abstract_header_left.jpg');
background-size: cover;
background-repeat: no-repeat;
height: 100vh;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
}
.brand-title {
font-size: 75px;
position: relative;
color: #fff;
padding: 0px;
margin: auto;
padding-top: 260px;
font-family: poppins-Extralight;
}
/* Right Header Block */
.header-right-block {
background-color: #FCDA02;
background-repeat: no-repeat;
height: 100vh;
z-index: -2;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
}
.header-right-content {
}
.slash {
font-size: 125px;
color: #fff;
padding: 400px 0px;
}
.sub-header {
color: #fff;
font-size: 30px;
font-family: poppins-bold;
}
.search-text {
font-family: poppins-regular;
color: #fff;
display: inline-block;
padding: 25px 10px;
}
.top-btns {
height: auto;
display: inline-block;
position: absolute;
right: 0;
top: 0;
padding: 5px 30px;
}
/* Section Two */
.section-two {
background-color:;
height: 1000px;
width: 100%;
position: relative;
box-sizing: border-box;
padding: 50px;
margin-bottom: 100px;
}
.section-two:after {
position: absolute;
width: 100%;
height: 100%;
content: '';
background: #00ACC2;
top: 0;
bottom: 0;
right: 0;
left: 0;
transform-origin:;
transform: skewY(-30deg);
margin-top: -8px;
z-index: -1;
}
.section-two-container {
padding-bottom: 400px;
align-content: flex-start;
}
.number {
font-size: 20vw;
color: #fff;
font-family: poppins-mediumitalic;
}
.item-text {
text-align: left;
font-size: 2vh;
color: #fff;
padding: 2px;
}
.sub-header-one {
color: #fff;
font-size: 5vh;
font-family: poppins-bold;
text-align: left;
}
.squiggel {
z-index: 1;
}
/* Section Three */
.section-three {
background-color:;
height: 1200px;
width: 100%;
position: relative;
box-sizing: border-box;
padding: 50px;
margin-top: 0px;
}
.section-three:after {
position: absolute;
width: 100%;
height: 100%;
content: '';
background: #83C200;
top: 0;
bottom: 0;
right: 0;
left: 0;
transform-origin: top right;
transform: skewY(30deg);
z-index: -1;
}
.section-three-content {
margin-top: -1500px;
}
.iphone {
padding-left: 100px;
}
/* Section Four */
.section-four {
background-color:#111;
height: 1200px;
width: 100%;
position: relative;
box-sizing: border-box;
padding: 50px;
margin-top: -800px;
}
/* Menu */
/* Media Queries */
#media only screen and (max-width: 630px) {
.section-two-container {
margin-top: -200px;
}
.section-three-content {
margin-top: -100px;
}
.section-four {
margin-top: -225px;
}
.sub-header-one {
font-size: 4vh;
}
.number {
}
}
/* Font */
#poppins-bold {
font-family: poppins-bold;
src: url(../fonts/Poppins-Bold.ttf);
}
#poppins-regular {
font-family: poppins-regular;
src: url(../fonts/Poppins-Regular.ttf);
}
#poppins-Extralight {
font-family: poppins-extralight;
src: url(../fonts/Poppins-ExtraLight.ttf);
}
#poppins-MediumItalic {
font-family: poppins-mediumitalic;
src: url(../fonts/Poppins-MediumItalic.ttf);
}
/* Mouse Scroll */
p {
margin-left: -55px;
}
#-webkit-keyframes ani-mouse {
0% {
opacity: 1;
top: 29%;
}
15% {
opacity: 1;
top: 50%;
}
50% {
opacity: 0;
top: 50%;
}
100% {
opacity: 0;
top: 29%;
}
}
#-moz-keyframes ani-mouse {
0% {
opacity: 1;
top: 29%;
}
15% {
opacity: 1;
top: 50%;
}
50% {
opacity: 0;
top: 50%;
}
100% {
opacity: 0;
top: 29%;
}
}
#keyframes ani-mouse {
0% {
opacity: 1;
top: 29%;
}
15% {
opacity: 1;
top: 50%;
}
50% {
opacity: 0;
top: 50%;
}
100% {
opacity: 0;
top: 29%;
}
}
.scroll-btn {
display: inline-block;
position: relative;
left: 0;
right: 0;
text-align: center;
margin-bottom: 50px;
z-index: 100;
}
.scroll-btn > * {
display: inline-block;
line-height: 18px;
font-size: 13px;
font-weight: normal;
color: #7f8c8d;
color: #ffffff;
font-family: "proxima-nova", "Helvetica Neue", Helvetica, Arial, sans-serif;
letter-spacing: 2px;
}
.scroll-btn > *:hover,
.scroll-btn > *:focus,
.scroll-btn > *.active {
color: #ffffff;
}
.scroll-btn > *:hover,
.scroll-btn > *:focus,
.scroll-btn > *:active,
.scroll-btn > *.active {
opacity: 0.8;
filter: alpha(opacity=80);
}
.scroll-btn .mouse {
position: relative;
display: block;
width: 35px;
height: 55px;
margin: 0 auto 20px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
border: 3px solid white;
border-radius: 23px;
}
.scroll-btn .mouse > * {
position: absolute;
display: block;
top: 29%;
left: 50%;
width: 8px;
height: 8px;
margin: -4px 0 0 -4px;
background: white;
border-radius: 50%;
-webkit-animation: ani-mouse 2.5s linear infinite;
-moz-animation: ani-mouse 2.5s linear infinite;
animation: ani-mouse 2.5s linear infinite;
section class="grid-x align-middle section-two">
<section class="small-12 medium-5 section-two-container">
<div class="grid-x grid-container align-middle">
<div class="small-12 hide-for-small-only squiggel"><img src="img/red-squiggel.png" style=" height: 350px;"></div>
</div>
</section>
<section class="small-12 medium-7 section-two-container">
<div class="grid-x align-top grid-container ">
<div class="small-4 medium-4 large-5 flex-child-auto"><h1 class="number"> 1 </h1></div>
<div class="small-8 medium-8 large-7 flex-child-auto">
<h2 class="sub-header-one">website design and development</h2>
<p class="item-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
</div>
</div>
</section>
</section>
<!-- End Section Two -->
<section class="grid-x align-middle section-three">
<div class="section-three-content small-12 medium-7">
<div class="grid-x grid-container grid-padding-x align-center">
<div class="small-4 medium-4 large-5 "><h1 class="number"> 2 </h1></div>
<div class="small-8 medium-8 large-7 ">
<h2 class="sub-header-one">search engine optimization</h2>
<p class="item-text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p>
</div>
</div>
</div>
<div class="section-three-content grid-container small-12 medium-5 iphone"><img src="img/iphone-x.png"></div>
</section>
<section class="grid-x align-middle section-four">
</section>