I need the image cards to align like pinterest. I have attached an image of what I am trying to get it to do.
==================================================
Project Images
================================================== -->
.project-images .section-heading .title {
padding-bottom: 0px;
font-size: 250%;
line-height: 1.1;
font-weight: 400;
color: #1c1c1c;
text-transform: uppercase;
}
.project-images {
padding: 80px
}
.project-imgsub {
padding-bottom: 50px;
margin-top: 0;
color: #666;
font-size: 30px;
font-weight: 700;
letter-spacing: 1px;
}
.project-images .service-parts .block {
margin-bottom: 0px;
text-align: center;
}
.project-images .service-parts .block i {
font-size: 35px;
color: #00bfff;
}
.project-images .service-parts .block p {
padding: 0 8px;
font-size: 14px;
color: #777;
line-height: 1.7;
}
.project-images figure .buttons {
position: absolute;
top: 45%;
left: 13%;
}
.project-images h2 {
padding: 20px;
}
.project-images .img-cust {
display: inline-block;
}
figure {
background: #fff;
margin-bottom: 45px;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.22), 0 2px 10px 0 rgba(0, 0, 0, 0.22);
}
figure .img-wrapper {
position: relative;
overflow: hidden;
}
figure img {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
-webkit-transition: -webkit-transform 400ms;
transition: transform 400ms;
}
figure:hover img {
-webkit-transform: scale3d(1.2, 1.2, 1);
transform: scale3d(1.2, 1.2, 1);
}
<section class="project-images">
<div class="container">
<div class="section-heading">
<h3 class="title wow fadeInDown" data-wow-delay=".3s"> TEXT </h3>
<h3 class="project-imgsub">Images and Details</h3>
<div class="row">
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE TEXT</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristique eros, sed auctor diam justo et tellus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque lobortis nibh a nisl malesuada scelerisque. Vivamus malesuada nisi nisi, eu tempor ipsum finibus vitae. Ut at leo lacus.
</p>
</figcaption>
<div class="img-wrapper">
<img src="images/hid.png " class="img-responsive" >
</div>
</figure>
</div>
<div class="row">
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE Text text text text</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristique eros, sed auctor diam justo
</p>
</figcaption>
<div class="img-wrapper">
<img src="images/hid.png " class="img-responsive" >
</div>
</figure>
</div>
<div class="row">
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2> TITLE Text tex text</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna,
</p>
</figcaption>
<div class="img-wrapper">
<img src="images/hid.png " class="img-responsive" >
</div>
</figure>
</div>
<div class="row">
<div class="col-sm-4">
<figure class="wow fadeInLeft animated portfolio-item res-wall" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE Text text text text</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristique eros, sed auctor diam justo et tellus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque lobortis nibh a nisl malesuada scelerisque. Vivamus malesuada
<p>
</figcaption>
<div class="img-wrapper">
<img src="images/hid.png " class="img-responsive" >
</div>
</figure>
</div>
<div class="row">
<div class="col-sm-4">
<figure class="wow fadeInLeft animated portfolio-item res-wall" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE TEXT TEXT TEXT</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristique eros, sed auctor diam justo et tellus. Lorem ipsum dolor sit amet, consectetur
</p>
</figcaption>
<div class="img-wrapper">
<img src="images/hid.png " class="img-responsive" >
</div>
</figure>
</div>
<div class="row">
<div class="col-sm-4">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2> TITLE TEXT TEXT </h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna,
</p>
</figcaption>
<div class="img-wrapper">
<img src="images/hid.png " class="img-responsive" >
</div>
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
JSFiddle
If you want the layout in the image it is called a Masonry layout mentioned here - how-to-create-grid-tile-view-with-css also here - css-floating-divs-at-variable-heights both answers suggest using jQuery Masonry but you could also use columns.
But as an alternative you could use equal height columns like I have done in the code below.
div {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.flex{
display: flex;
flex-wrap: wrap;
margin: auto;
}
.col-sm-4{
max-width: 100%;
width: 33%;
display: flex;
}
.project-images .section-heading .title {
padding-bottom: 0px;
font-size: 250%;
line-height: 1.1;
font-weight: 400;
color: #1c1c1c;
text-transform: uppercase;
}
.project-images {
padding: 80px
}
.project-imgsub {
padding-bottom: 50px;
margin-top: 0;
color: #666;
font-size: 30px;
font-weight: 700;
letter-spacing: 1px;
}
.project-images .service-parts .block {
margin-bottom: 0px;
text-align: center;
}
.project-images .service-parts .block i {
font-size: 35px;
color: #00bfff;
}
.project-images .service-parts .block p {
padding: 0 8px;
font-size: 14px;
color: #777;
line-height: 1.7;
}
.project-images figure .buttons {
position: absolute;
top: 45%;
left: 13%;
}
.project-images h2 {
padding: 20px 20px 0px 20px;
text-align: center;
margin-bottom: 0;
}
.project-images .img-cust {
display: inline-block;
}
p.para {
padding: 0 20px 0 20px;
text-align: center;
}
figure {
background: #fff;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.22), 0 2px 10px 0 rgba(0, 0, 0, 0.22);
-webkit-margin-end: 0;
-webkit-margin-start: 0;
-webkit-margin-before: 0em;
-webkit-margin-after: 0em;
margin: 10px 10px 5px 10px;
}
figure .img-wrapper {
position: relative;
overflow: hidden;
}
figure img {
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
-webkit-transition: -webkit-transform 400ms;
transition: transform 400ms;
width: 100%;
max-width: 100%;
}
figure:hover img {
-webkit-transform: scale3d(1.2, 1.2, 1);
transform: scale3d(1.2, 1.2, 1);
}
<section class="project-images">
<div class="container">
<div class="section-heading">
<h3 class="title wow fadeInDown" data-wow-delay=".3s"> TEXT </h3>
<h3 class="project-imgsub">Images and Details</h3>
<div class="row flex">
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE TEXT</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec po
</p>
</figcaption>
<div class="img-wrapper">
<img src="" alt="img-here" class="img-responsive" >
</div>
</figure>
</div>
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE TEXT</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristique er
</p>
</figcaption>
<div class="img-wrapper">
<img src="" alt="img-here" class="img-responsive" >
</div>
</figure>
</div>
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE TEXT</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristiqu
</p>
</figcaption>
<div class="img-wrapper">
<img src="" alt="img-here" class="img-responsive" >
</div>
</figure>
</div>
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE TEXT</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristiqu
</p>
</figcaption>
<div class="img-wrapper">
<img src="" alt="img-here" class="img-responsive" >
</div>
</figure>
</div>
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE TEXT</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristiqu
</p>
</figcaption>
<div class="img-wrapper">
<img src="" alt="img-here" class="img-responsive" >
</div>
</figure>
</div>
<div class="col-sm-4 ">
<figure class="wow fadeInLeft animated portfolio-item" data-wow-duration="500ms" data-wow-delay="0ms">
<figcaption>
<h2>TITLE TEXT</h2>
<p class="para">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac laoreet magna, nec posuere leo. Aenean justo nibh, ultricies consequat faucibus in, molestie vel metus. Pellentesque dignissim, nisl in luctus ornare, ex est tristiqu
</p>
</figcaption>
<div class="img-wrapper">
<img src="" alt="img-here" class="img-responsive" >
</div>
</figure>
</div>
</div>
</div>
</div>
</section>
Related
I'm not sure how better to describe it, so:
I have a grid for 12 columns. (2 identical icons and 2 texts with different heights) per 6 columns. Is there any way to align icons by center and texts by the same height? I'm able to align icons but texts are always on different heights.
.benefits .benefits_item {
display: flex;
justify-content: center;
align-items: center;
margin-top: 35px;
min-height: 150px;
}
.benefits .benefits_item .benefits_round {
display: flex;
justify-content: center;
align-items: center;
margin-right: 25px;
width: 116px;
height: 116px;
background: #1EACC7;
border-radius: 50%;
}
.benefits .benefits_item .benefits_descr {
width: 370px;
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-size: 15px;
color: #202020;
}
.benefits .benefits_item .benefits_descr span {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-size: 17px;
line-height: 25px;
color: #1EACC7;
<div class="row">
<div class="col-md-6">
<div class="benefits_item">
<div class="benefits_round"><img src="" alt="1" class="benefits_icon"></div>
<div class="benefits_descr"><span>Lorem ipsum dolor sit ame</span><br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu ligula, lacinia vel fermentum elementum</div>
</div>
</div>
<div class="col-md-6">
<div class="benefits_item">
<div class="benefits_round"><img src="" alt="2" class="benefits_icon"></div>
<div class="benefits_descr"><span>Lorem ipsum</span><br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu ligula, lacinia vel fermentum elementum, malesuada vel ante. Donec ut odio augue. Integer a aliquet quam. Aenean ut enim ullamcorper, feugiat neque ac,
pretium augue.</div>
</div>
</div>
</div>
You can add align-items-center to <div class="row"> -- Bootstrap's rows use display: flex so you can use other flex utility classes on the row
:root {
--color: #1EACC7;
--iconSize: 6rem;
}
.benefits_round {
height: var( --iconSize );
max-width: var( --iconSize ); min-width: var( --iconSize );
background-color: var( --color );
}
.benefits_descr span { color: var( --color ) }
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<div class="container-md">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="d-flex justify-content-center align-items-center">
<div class="benefits_round rounded-circle me-4 d-flex justify-content-center align-items-center">
<img src="" alt="1">
</div>
<div class="benefits_descr fw-light">
<span class="fs-5">Lorem ipsum dolor sit ame</span>
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu ligula, lacinia vel fermentum elementum
</div>
</div>
</div>
<div class="col-sm-6">
<div class="d-flex justify-content-center align-items-center">
<div class="benefits_round rounded-circle me-4 d-flex justify-content-center align-items-center">
<img src="" alt="2">
</div>
<div class="benefits_descr fw-light">
<span class="fs-5">Lorem ipsum</span>
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu ligula, lacinia vel fermentum elementum, malesuada vel ante. Donec ut odio augue. Integer a aliquet quam. Aenean ut enim ullamcorper, feugiat neque ac, pretium augue.
</div>
</div>
</div>
</div>
</div>
I am new to webdevelopment and have this issue. For this I created a Codepen
For the 6 cards I wanted to ad an image. When I hover over the image it should swap the card and show content. So when the first three cards swaps it still shows up an image instead of the content as the under the first three cards.
So my idea is: when I hover over an image it should swap the card and show only a white background with content as the under three cards.
Can anyone assist me here on how to do it?
.services .icon-box {
text-align: center;
border: 1px solid #e2eefd;
padding: 80px 20px;
transition: all ease-in-out 0.3s;
}
.services .icon-box .icon {
margin: 0 auto;
width: 64px;
height: 64px;
background: #f1f6fe;
border-radius: 4px;
border: 1px solid #deebfd;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20px;
transition: ease-in-out 0.3s;
}
.services .icon-box .icon i {
color: #3b8af2;
font-size: 28px;
transition: ease-in-out 0.3s;
}
.services .icon-box h4 {
font-weight: 700;
margin-bottom: 15px;
font-size: 24px;
}
.services .icon-box h4 a {
color: #222222;
transition: ease-in-out 0.3s;
}
.services .icon-box p {
line-height: 24px;
font-size: 14px;
margin-bottom: 0;
margin-top: 0;
}
.services .icon-box:hover {
border-color: #fff;
box-shadow: 0px 0 25px 0 rgba(16, 110, 234, 0.1);
}
.services .icon-box:hover h4 a, .services .icon-box:hover .icon i {
color: #106eea;
}
.services .icon-box:hover .icon {
border-color: #106eea;
}
.flip-card {
background-color: transparent;
height: 337px;
}
.flip-card:hover .flip-card-inner {
transform: rotateY(180deg);
}
.align-items-stretch:hover .flip-card-front {
display: none;
}
.flip-card-inner{
width: 100%;
height: 100%;
transition: transform 0.6s;
transform-style: preserve-3d;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
background-size: cover;
background-repeat: no-repeat;
}
.flip-card-front, .flip-card-back {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.flip-card-back {
color: black;
transform: rotateY(180deg);
}
.flip-card:last-child {
margin-bottom: 0;
}
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Roboto:300,300i,400,400i,500,500i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<section id="services" class="services">
<div class="container" data-aos="fade-up">
<div class="section-title">
<h2>Lorem</h2>
<h3>Lorem <span>.</span></h3>
<p>Praesent in dui nec lorem vulputate hendrerit quis vel nisl. Aenean at auctor augue. Vivamus facilisis pretium suscipit. Praesent nec turpis pellentesque elit iaculis tristique et at justo. Pellentesque feugiat, leo nec rutrum aliquam, dui est pulvinar diam, ut elementum velit nibh vitae ipsum. Morbi id lacinia risus. Etiam faucibus erat ac nibh aliquet laoreet. Sed velit ante, auctor sed imperdiet id, elementum a justo. Nullam condimentum metus vitae porttitor tincidunt.</p>
</div>
<div class="row">
<div class="col-lg-4 col-md-6 d-flex align-items-stretch flip-card" data-aos="zoom-in" data-aos-delay="100">
<div class="icon-box flip-card-inner" style="background-image: url('https://images.unsplash.com/photo-1611095790444-1dfa35e37b52?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1051&q=80');">
<div class="flip-card-front">
<div class="icon"><i class="bx bxs-user-account"></i></div>
<h4>Lorem</h4>
</div>
<div class="flip-card-back">
<p style="font-size: 16px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ultrices, tellus in ullamcorper sodales, felis dui condimentum dolor, quis feugiat nunc mi nec turpis. Proin convallis ultrices quam et condimentum.</p>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 d-flex align-items-stretch mt-4 mt-md-0 flip-card" data-aos="zoom-in" data-aos-delay="100">
<div class="icon-box flip-card-inner" style="background-image: url('https://images.unsplash.com/photo-1560732488-6b0df240254a?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80');">
<div class="flip-card-front">
<div class="icon"><i class="bx bx-server"></i></div>
<h4>Lorem</h4>
</div>
<div class="flip-card-back">
<p style="font-size: 16px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ultrices, tellus in ullamcorper sodales, felis dui condimentum dolor, quis feugiat nunc mi nec turpis. Proin convallis ultrices quam et condimentum.</p>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 d-flex align-items-stretch mt-4 mt-lg-0 flip-card" data-aos="zoom-in" data-aos-delay="100">
<div class="icon-box flip-card-inner" style="background-image: url('https://images.unsplash.com/photo-1454779132693-e5cd0a216ed3?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1051&q=80');">
<div class="flip-card-front">
<div class="icon"><i class="bx bx-network-chart"></i></div>
<h4>Lorem</h4>
</div>
<div class="flip-card-back">
<p style="font-size: 16px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ultrices, tellus in ullamcorper sodales, felis dui condimentum dolor, quis feugiat nunc mi nec turpis. Proin convallis ultrices quam et condimentum..</p>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 d-flex align-items-stretch mt-4 flip-card" data-aos="zoom-in" data-aos-delay="100">
<div class="icon-box flip-card-inner" style="text-align: center;">
<div class="flip-card-front">
<div class="icon"><i class="bx bx-world"></i></div>
<h4>Lorem</h4>
</div>
<div class="flip-card-back">
<p style="font-size: 16px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ultrices, tellus in ullamcorper sodales, felis dui condimentum dolor, quis feugiat nunc mi nec turpis. Proin convallis ultrices quam et condimentum.</p>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 d-flex align-items-stretch mt-4 flip-card" data-aos="zoom-in" data-aos-delay="100">
<div class="icon-box flip-card-inner" style="text-align: center;">
<div class="flip-card-front">
<div class="icon"><i class="bx bx-star"></i></div>
<h4>Lorem</h4>
</div>
<div class="flip-card-back">
<p style="font-size: 16px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ultrices, tellus in ullamcorper sodales, felis dui condimentum dolor, quis feugiat nunc mi nec turpis. Proin convallis ultrices quam et condimentum.</p>
</div>
</div>
</div>
<div class="col-lg-4 col-md-6 d-flex align-items-stretch mt-4 flip-card" data-aos="zoom-in" data-aos-delay="100">
<div class="icon-box flip-card-inner" style="text-align: center;">
<div class="flip-card-front">
<div class="icon"><i class="bx bx-coin-stack"></i></div>
<h4>Lorem</h4>
</div>
<div class="flip-card-back">
<p style="font-size: 16px;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ultrices, tellus in ullamcorper sodales, felis dui condimentum dolor, quis feugiat nunc mi nec turpis. Proin convallis ultrices quam et condimentum.</p>
</div>
</div>
</div>
</div>
</div>
</section>
Thank you very much!
You need to hide the image when you show the back of the card. The easiest way to your given code is to set the size of the background to 0.
.flip-card:hover .flip-card-inner {
transform: rotateY(180deg);
background-size: 0; /* Added to hide the background image. */
}
I created this layout, its almost there but I'm struggling with the images and text beside it. I want the entire box to flex at the same time, to keep the images and text responding at the same time.
What am I doing wrong? I think I am suffering from a mental block because this is my first time using flex.
.container {
max-width: 1750px;
}
.venture,
#event-content,
#news-content {
background-color: #eaeaea;
color: #444;
}
.catch {
color: #fff;
text-align: center;
margin: 1vmin 0vmin 0vmin 0vmin;
padding: 20px 50px;
background-color: #3366cc;
}
.tagline {
margin-top: 5%;
text-align: center;
font-weight: bold;
font-size: 130%;
}
#news-content a:link,
#news-content a:hover,
#news-content a:visited {
text-decoration: none;
color: #444;
font-family: FG Font;
font-size: 2vmin;
}
#news-content .btn.btn-primary {
background-color: #3366cc;
font-family: Arial;
border-color: #3366cc;
}
#news-content .tag {
background-color: #ef8b1e;
display: inline-block;
padding: 5px;
border-radius: 0px 0px 5px 5px;
font-size: 1.5vmin;
font-family: FG Font;
}
#news-content .title {
padding: 25px 10px 0px 10px;
}
#event-content .date {
background-color: #ef8b1e;
font-family: FG Font;
font-size: 3vmin;
display: inline-block;
text-align: center;
}
.main-wrapper {
display: flex;
flex-wrap: nowrap;
height: 70vh;
align-items: stretch;
}
.main-wrapper>div {
width: 50%;
min-height: 50vh;
}
.hero-img {
display: flex;
}
.hero-img>div {
margin: 1vmin;
align-self: stretch;
flex-basis: 50%;
}
.info-section {
display: flex;
flex-direction: column;
align-items: stretch;
}
.info-section .media-section {
margin: 1vmin 0vmin;
}
.info-section .venture {
position: relative;
padding: 3vmin 3vmin 2vmin 3vmin;
}
.media-section>div {
display: flex;
flex-direction: row;
}
.media-section>div>div {
flex-basis: 50%;
}
#news-content {
margin-right: .5vmin;
}
#event-content {
margin-left: .5vmin;
}
#news-content,
#event-content {
max-height: 150px;
}
<div class="container">
<div class="main-wrapper">
<div>
<div class="hero-img">
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Ship" /></div>
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Ship" /></div>
</div>
<div class="hero-img">
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Air" /></div>
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Helicopter" /></div>
</div>
</div>
<div>
<div class="info-section">
<div class="catch">
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h1>
</div>
<div class="media-section">
<div>
<div id="news-content">
<div class="tag">In the News</div>
<div class="title">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<a href="">
<div class="btn btn-primary">Link</div>
</a>
</div>
<div id="event-content">
<div class="date">
<div class="num">12</div>
<div class="month">DEC</div>
</div>
<div class="details">
<div class="title">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<div class="info">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
</div>
</div>
</div>
</div>
<div class="venture">
<h2>Lorem ipsum dolor sit ametn<br>Lorem ipsum dolor sit amet</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam diam non mollis sollicitudin. Curabitur sed felis ac urna laoreet finibus nec eu sem. Fusce cursus tortor eget lectus lacinia, id blandit dolor ultrices. Aliquam pellentesque
venenatis turpis, a viverra ante tincidunt vel. Quisque dui orci, viverra id ipsum eget, dictum mattis ante. Aliquam pellentesque massa et euismod efficitur. Aliquam vestibulum velit et lobortis feugiat. Curabitur vulputate quam efficitur,
pellentesque ex quis, tincidunt orci. Donec magna est, ultrices nec pretium nec, porta id nisl. Mauris vitae magna ac sem pellentesque hendrerit. Donec elit justo, pulvinar id leo posuere, venenatis mattis nisl. Maecenas tristique augue ut
odio tincidunt aliquam. Nullam volutpat lobortis eros.</p>
<div class="tagline">LOREM IPSUM</div>
</div>
</div>
</div>
</div>
</div>
Not sure if that you want, the entire container in same column can be done like that :
<pre>
<div class="container">
<div class="main-wrapper">
<div>
<div class="info-section">
<div>
<div class="hero-img">
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Ship" /></div>
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Ship" /></div>
</div>
<div class="hero-img">
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Air" /></div>
<div><img src="https://via.placeholder.com/100x100" class="img-fluid" alt="Allied Helicopter" /></div>
</div>
</div>
<div class="catch">
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h1>
</div>
<div class="media-section">
<div>
<div id="news-content">
<div class="tag">In the News</div>
<div class="title">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<a href="">
<div class="btn btn-primary">Link</div>
</a>
</div>
<div id="event-content">
<div class="date">
<div class="num">12</div>
<div class="month">DEC</div>
</div>
<div class="details">
<div class="title">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
<div class="info">Lorem ipsum dolor sit amet, consectetur adipiscing elit</div>
</div>
</div>
</div>
</div>
<div class="venture">
<h2>Lorem ipsum dolor sit ametn<br>Lorem ipsum dolor sit amet</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed aliquam diam non mollis sollicitudin. Curabitur sed felis ac urna laoreet finibus nec eu sem. Fusce cursus tortor eget lectus lacinia, id blandit dolor ultrices. Aliquam pellentesque
venenatis turpis, a viverra ante tincidunt vel. Quisque dui orci, viverra id ipsum eget, dictum mattis ante. Aliquam pellentesque massa et euismod efficitur. Aliquam vestibulum velit et lobortis feugiat. Curabitur vulputate quam efficitur,
pellentesque ex quis, tincidunt orci. Donec magna est, ultrices nec pretium nec, porta id nisl. Mauris vitae magna ac sem pellentesque hendrerit. Donec elit justo, pulvinar id leo posuere, venenatis mattis nisl. Maecenas tristique augue ut
odio tincidunt aliquam. Nullam volutpat lobortis eros.</p>
<div class="tagline">LOREM IPSUM</div>
</div>
</div>
</div>
</div>
</div>
</pre>
I need help with an invisible/inexplicable space gap in my webpage, in the screen screenshots below you can see the space (the red area):
I need that they behavior just like the other row below "LMP" and "LMB"
In Safari the space gap is not present, but in chrome and firefox this space appears, ain honestly I don't kow what to do, i detected that the container class with a width:80% desapears the gap, but then the page becomes too thin.
Here is a
JSfiddle
IF anyone has the same problem, above the titles I have a header, in this I missed a /div so the next row was complete crazy...thanks to all for helping me, i really apreciate the help
You need to make <div class="row">
before any col-md/col-lg/col-sm Because Bootstrap keep 15px Padding for this.
Update jsfiddle solution:
Update solution in codepen Link
And Update Snipper
/***** 3.- NEWS AND CONTENT *******/
.news-section {
background-color: #F1EFEF;
height: 1500px;
}
.black-title {
margin-top: 50px;
height: 60px;
width:112%;
margin-left: -15px;
background-color: #4A90E2;
text-align: center;
line-height: 60px;
}
.black-title > h3 {
vertical-align: middle;
}
.white-title {
margin-top: 50px;
height: 60px;
margin-left: -15px;
background-color: #3F444A;
color: #fff;
text-align: center;
line-height: 60px;
}
.white-title > h3 {
vertical-align: middle;
}
.title-section-2 {
margin-top:0px;
height: 100%;
}
.news-content {
margin-top: 25px;
display: block;
}
.news-content img {
margin:auto;
background-color: #F1EFEF;
}
.news-link {
text-align: right;
margin: 10px;
}
.news-link a {
color: #E7BF3A;
text-decoration: none;
}
.spot-horizontal {
height: 90px;
margin-top: 10px;
background-color: #BD10E0;
}
.logos-horizontal {
height: 50px;
background-color: #3F444A;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<section>
<div class="container">
<div class="row">
<div class="news-section">
<div class="col-md-6 col-sm-6">
<div class="row">
<h3 class=" black-title">Lo más nuevo</h3>
<div class="news-content">
<img class="img-responsive" src="http://placehold.it/500x400" alt="" >
</div>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="row">
<h3 class="white-title">Videos más nuevos</h3>
<div class="news-content">
<img class="img-responsive" src="http://placehold.it/500x400" alt="" >
</div>
</div>
</div>
<div class="col-md-12 spot-horizontal">
<div class="row">
<h3 class="title-black">PUBLICIDAD</h3>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="row">
<h3 class=" black-title title-section-2">LMB</h3>
<div class="news-content">
<h4>Titulo de noticia</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean molestie aliquet tristique. Proin aliquam neque quis est sagittis, tempus sagittis tortor mattis. Praesent nec gravida.</p>
<h4>Titulo de noticia</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean molestie aliquet tristique. Proin aliquam neque quis est sagittis, tempus sagittis tortor mattis. Praesent nec gravida.</p>
<div class="news-link">
Más Noticias
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-6">
<div class="row">
<h3 class="white-title title-section-2">LMP</h3>
<div class="news-content">
<h4>Titulo de noticia</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean molestie aliquet tristique. Proin aliquam neque quis est sagittis, tempus sagittis tortor mattis. Praesent nec gravida.</p>
<h4>Titulo de noticia</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean molestie aliquet tristique. Proin aliquam neque quis est sagittis, tempus sagittis tortor mattis. Praesent nec gravida.</p>
<div class="news-link">
Más Noticias
</div>
</div>
</div>
</div>
<div class="col-md-12 logos-horizontal">
<div class="row">
<h3 class="white-title title-section-2">LOGOS</h3>
</div>
</div>
</div>
</div>
</div>
</section>
Both divs have to be inline-block and have the same parent.
Here's a fiddle: https://jsfiddle.net/fbrh1464/6
How to remove this whitespace ->
I want to make that two image in the bottom to move up like the one on the right.
I think I shouldn't use col-md-* but still dont get the idea.
.portfolio {
}
.portfolio h4 {
font-size: 28px;
font-weight: 600;
font-family: 'Lora', serif;
margin-bottom: 20px;
}
.portfolio-item {
padding: 10px;
border-bottom: 1px solid #eee;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="portfolio col-md-10-col-md-offset-1">
<h4>Portfolio</h4>
<div class="row">
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQCjQExMw62RkDP1tvZlwy1J5ADRnZ-ani4mm5Raezxh4DEabaL5A" alt="">
<h3>Wongilang.xyz</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat at neque in tincidunt. Suspendisse blandit tellus vitae nunc congue, at tristique nulla sodales. </p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQ8zJArifA6qRmMAvaZL_EGhHZsRYc4te-OtUqXABmoctaLpHw-pQ" alt="">
<h3>Intanrahmadhani.web.id</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat at neque in tincidunt. Suspendisse blandit tellus vitae nunc congue, at tristique nulla sodales. </p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQCjQExMw62RkDP1tvZlwy1J5ADRnZ-ani4mm5Raezxh4DEabaL5A" alt="">
<h3>E-Monev SD/SMP/SMA Muhammadiyah DIY</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat at neque in tincidunt. Suspendisse blandit tellus vitae nunc congue, at tristique nulla sodales. </p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="http://okdogi.com/wp-content/uploads/2015/12/kucing-Scotish-fold-.jpg" alt="">
<h3>Intanrahmadhani.web.id</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat at neque in tincidunt. Suspendisse blandit tellus vitae nunc congue, at tristique nulla sodales. </p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQCjQExMw62RkDP1tvZlwy1J5ADRnZ-ani4mm5Raezxh4DEabaL5A" alt="">
<h3>Wongilang.xyz</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat at neque in tincidunt. Suspendisse blandit tellus vitae nunc congue, at tristique nulla sodales. </p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQ8zJArifA6qRmMAvaZL_EGhHZsRYc4te-OtUqXABmoctaLpHw-pQ" alt="">
<h3>Intanrahmadhani.web.id</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat at neque in tincidunt. Suspendisse blandit tellus vitae nunc congue, at tristique nulla sodales. </p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQCjQExMw62RkDP1tvZlwy1J5ADRnZ-ani4mm5Raezxh4DEabaL5A" alt="">
<h3>E-Monev SD/SMP/SMA Muhammadiyah DIY</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat at neque in tincidunt. Suspendisse blandit tellus vitae nunc congue, at tristique nulla sodales. </p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="http://okdogi.com/wp-content/uploads/2015/12/kucing-Scotish-fold-.jpg" alt="">
<h3>Intanrahmadhani.web.id</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut volutpat at neque in tincidunt. Suspendisse blandit tellus vitae nunc congue, at tristique nulla sodales.</p>
</div>
</div>
</div>
</div>
</div>
It seems like your images have different height so you can see the white space below the first image and second image aren't the same and the last 2 images appear right after the 4th image (intanrahmadhani.web.id).
You can either resize/crop these images to make sure the height is consistent or apply a fixed height to the image container.
.portfolio h4 {
font-size: 28px;
font-weight: 600;
font-family: 'Lora', serif;
margin-bottom: 20px;
}
.portfolio-item {
padding: 10px;
border-bottom: 1px solid #eee;
}
.portfolio-item > a:link,
.portfolio-item > a:visited {
display: block;
height: 300px;
overflow: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.0/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="portfolio">
<h4>Portfolio</h4>
<div class="row">
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="http://placehold.it/450x650" alt="">
<h3>Wongilang.xyz</h3>
<p>...</p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="http://placehold.it/450x450" alt="">
<h3>Intanrahmadhani.web.id</h3>
<p>...</p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="http://placehold.it/450x250" alt="">
<h3>E-Monev SD/SMP/SMA Muhammadiyah DIY</h3>
<p>...</p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="http://placehold.it/450x550" alt="">
<h3>Intanrahmadhani.web.id</h3>
<p>...</p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="http://placehold.it/450x350" alt="">
<h3>E-Monev SD/SMP/SMA Muhammadiyah DIY</h3>
<p>...</p>
</div>
<div class="col-md-4 portfolio-item">
<img class="img-responsive" src="http://placehold.it/450x750" alt="">
<h3>Wongilang.xyz</h3>
<p>...</p>
</div>
</div>
</div>