Handle distance other items similar new item CSS - html

When a new item I want handle the other items will have a distance similar to the new item, but only processed by css okay? If possible, I do not want to handle by adding the distance available for the item as this is in contravention of the design...................................................................
Thanks for your help!
.list_item_grid {
padding: 0 7px;
margin-bottom: 63px;
list-style: none;
}
.list_item_grid .item {
float: left;
width: calc(100%/4 - 2px);
margin-right: 2px;
margin-bottom: 7px;
}
.list_item_grid .item:last-child {
margin-right: 0;
}
.list_item_grid .thumb_img {
height: 180px;
position: relative;
overflow: hidden;
}
.list_item_grid img {
position: absolute;
width: auto;
max-height: 100%;
height: auto;
border: none;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.list_item_grid a {
text-decoration: none;
}
.list_item_grid .date {
padding: 9px 14px 3px;
color: #7b7b7b;
}
.list_item_grid .txt_link {
margin-top: 0;
padding: 0 22px 0 14px;
}
.list_item_grid a:hover .txt_link {
text-decoration: none;
color: #2b7bcd;
}
.list_item_grid li.new > p:first-child:before {
content: "NEW"
}
<ul class="list_item_grid clearfix">
<li class="item new">
<p></p>
<a href="#">
<div class="thumb_img"><img src="https://placehold.jp/240x180.png" alt=""></div>
<div class="contents">
<p class="date">2018/08/03</p>
<p class="txt_link">abc</p>
</div>
</a>
</li>
<li class="item">
<p></p>
<a href="#">
<div class="thumb_img"><img src="https://placehold.jp/240x180.png" alt=""></div>
<div class="contents">
<p class="date">2018/08/03</p>
<p class="txt_link">abc</p>
</div>
</a>
</li>
<li class="item">
<p></p>
<a href="#">
<div class="thumb_img"><img src="https://placehold.jp/240x180.png" alt=""></div>
<div class="contents">
<p class="date">2018/08/03</p>
<p class="txt_link">abc</p>
</div>
</a>
</li>
<li class="item">
<p></p>
<a href="#">
<div class="thumb_img"><img src="https://placehold.jp/240x180.png" alt=""></div>
<div class="contents">
<p class="date">2018/08/03</p>
<p class="txt_link">abc</p>
</div>
</a>
</li>
</ul>
Link code

I have Completed it, Check out this
Here i added the class name for the paragraphs, then i add some css code.
.list_item_grid {
padding: 0 7px;
margin-bottom: 63px;
list-style: none;
}
.list_item_grid .item {
float: left;
width: calc(100%/4 - 2px);
margin-right: 2px;
margin-bottom: 7px;
}
.list_item_grid .item:last-child {
margin-right: 0;
}
.list_item_grid .thumb_img {
height: 180px;
position: relative;
overflow: hidden;
}
.list_item_grid img {
position: absolute;
width: auto;
max-height: 100%;
height: auto;
border: none;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.list_item_grid a {
text-decoration: none;
}
.list_item_grid .date {
padding: 9px 14px 3px;
color: #7b7b7b;
}
.list_item_grid .txt_link {
margin-top: 0;
padding: 0 22px 0 14px;
}
.list_item_grid a:hover .txt_link {
text-decoration: none;
color: #2b7bcd;
}
.list_item_grid li.new > p:first-child:before {
content: "NEW"
}
.para{
height: 20px;
margin: 0px;
padding: 15px 0px;
}
<ul class="list_item_grid clearfix">
<li class="item new">
<p class="para"></p>
<a href="#">
<div class="thumb_img"><img src="https://placehold.jp/240x180.png" alt=""></div>
<div class="contents">
<p class="date">2018/08/03</p>
<p class="txt_link">abc</p>
</div>
</a>
</li>
<li class="item">
<p class="para"></p>
<a href="#">
<div class="thumb_img"><img src="https://placehold.jp/240x180.png" alt=""></div>
<div class="contents">
<p class="date">2018/08/03</p>
<p class="txt_link">abc</p>
</div>
</a>
</li>
<li class="item">
<p class="para"></p>
<a href="#">
<div class="thumb_img"><img src="https://placehold.jp/240x180.png" alt=""></div>
<div class="contents">
<p class="date">2018/08/03</p>
<p class="txt_link">abc</p>
</div>
</a>
</li>
<li class="item">
<p class="para"></p>
<a href="#">
<div class="thumb_img"><img src="https://placehold.jp/240x180.png" alt=""></div>
<div class="contents">
<p class="date">2018/08/03</p>
<p class="txt_link">abc</p>
</div>
</a>
</li>
</ul>

Related

Hovering figure HTML: clickable area larger than figure

I am relatively new to css/html.
I have been browsing about this issue for a while, but did not find a solution.
The issue is that, if I use the below code (that uses Bulma), the clickable area when hovering on img3.jpg is the entire block starting at the first <div class="columns is-multiline">. I suspect the issue might be some clash between Bulma is-column / is-multiline, and the overlay CSS definition I provided?
<style type="text/css">
ul {
list-style: none;
padding: 10px 10px 10px 30px
}
ul li {
font-size: 120%;
margin-left: 10px;
list-style-type: circle;
}
</style>
<style>
.container {
position: relative;
width: 100%;
}
.image {
display: block;
width: 100%;
height: auto;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: #008CBA;
}
.container:hover .overlay {
opacity: 1;
}
.text {
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
</style>
<div class="columns is-multiline">
<div class="column is-9">
<div class="content">
<h3> About us </h3>
<hr>
<p align="left" style="font-size:120%;">
some content ...
</p>
</div>
<div class="columns is-multiline">
<div class="column is-4">
<img src="/images/img1.jpg" alt="" class="image"/>
</div>
<div class="column is-4">
<img src="/images/img2.jpg" alt="" class="image"/>
</div>
<div class="column is-4">
<div class="container">
<img src="/images/img3.jpg" alt="" class="image"/>
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
</div>
</div>
<p align="left" style="font-size:120%;">
some text ...
<ul>
<li>
item 1
<a href="url1">
<b>link</b>
</a>
</li>
<li>
item2
<a href="url2">
<b>link</b></a>
</li>
</ul>
</p>
</div>
<div class="column is-3">
{% include latest-posts.html %}
</div>
</div>
<hr>
try this document
<!DOCTYPE html>
<html lang="en">
<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" href="https://cdn.jsdelivr.net/npm/bulma#0.9.4/css/bulma.min.css">
<title>Document</title>
<style>
body {
padding-top: 2em;
}
ul {
list-style: none;
padding: 10px 10px 10px 30px
}
ul li {
font-size: 120%;
margin-left: 10px;
list-style-type: circle;
}
.container {
position: relative;
width: 100%;
}
.columns {
display: flex;
}
.image {
display: block;
width: 100%;
max-width: 320px;
height: auto;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .5s ease;
background-color: #008CBA;
}
.container:hover .overlay {
opacity: 1;
}
.text {
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
text-align: center;
}
.test {
position: absolute;
left: 0;
border-bottom: green solid;
font-size: .5em;
font-weight: bold;
}
.test-top {
top: 0;
}
.test-bottom {
bottom: 0;
}
</style>
</head>
<body>
<div class="columns is-multiline">
<div class="column is-9">
<div class="content">
<h3> About us </h3>
<hr>
<p style="font-size:120%; text-align:left">
some content ...
</p>
</div>
<div class="columns is-multiline">
<p class="test test-top">start columns / is-multiline</p>
<div class="column is-4">
<img src="https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon-thumbnail.png" alt="" class="image" />
</div>
<div class="column is-4">
<img src="https://w7.pngwing.com/pngs/664/223/png-transparent-number-2-number-number-2-image-file-formats-text-heart-thumbnail.png" alt="" class="image" />
</div>
<div class="column is-4">
<div class="container">
<img src="https://w7.pngwing.com/pngs/111/727/png-transparent-number-3-illustration-number-blue-crystal-number-three-teal-number-symbol-thumbnail.png" alt="" class="image" />
<div class="overlay">
<p class="test test-top">star overlay</p>
<div class="text">Hello World</div>
<p class="test test-bottom">end overlay</p>
</div>
</div>
</div>
<p class="test test-bottom">end columns / is-multiline</p>
</div>
<p style="font-size:120%; text-align:left">
some text ...
<ul>
<li>
item 1
<a href="url1">
<b>link</b>
</a>
</li>
<li>
item2
<a href="url2">
<b>link</b></a>
</li>
</ul>
</p>
</div>
<div class="column is-3">
{% include latest-posts.html %}
</div>
</div>
<hr>
</body>
</html>

HTML UL jumping up when new element is added

I have tried to re-produce an example. I have a button when it is hovered it displays UL element. But the problem I have is If you were to try to add more li elements to UL it jumps up or if deleted any li element from existing list it jumps down. I can't figure out what's causing this. Any help appreciated.
.icon-box {
display: inline-block;
top: 50%;
left: 50%;
transform: translate(-50%, -170%);
position: relative;
text-align: center;
font-size: 24px;
margin-top: 100px;
}
.btn {
text-decoration: none;
color: black;
background-color: #a05344;
padding: 15px;
}
.container {
display: flex;
}
#nav-like {
position: absolute;
top: 51.5%;
left: 50%;
transform: translate(-82%, -40%);
width: 250px;
background-color: #C05555;
margin-top: 20px;
padding: 10px 30px;
visibility: hidden;
}
.movie-img {
height: 100px;
margin-right: 30px;
}
.like-name,
.like-release-date {
color: #BBBFCA;
font: 14px Arial, sans-serif font-weight:400;
}
.like-release-date {
margin-left: 5px;
}
.icon-box:hover+#nav-like {
visibility: visible;
}
<div class="icon-box">
click me
</div>
<ul id="nav-like">
<li class="container">
<div class="like-img">
<img src="https://github.com/saedsq/MovieLibrary/blob/master/src/img/nat-1.jpg?raw=true" class="movie-img" alt="rambo">
</div>
<div class="like-name">
<h3>Rambo</h3>
</div>
<div class="like-release-date">
<h3>( 2006 )</h3>
</div>
</li>
<li class="container">
<div class="like-img">
<img src="https://github.com/saedsq/MovieLibrary/blob/master/src/img/nat-1.jpg?raw=true" class="movie-img" alt="rambo">
</div>
<div class="like-name">
<h3>Rambo</h3>
</div>
<div class="like-release-date">
<h3>( 2006 )</h3>
</div>
</li>
<li class="container">
<div class="like-img">
<img src="https://github.com/saedsq/MovieLibrary/blob/master/src/img/nat-1.jpg?raw=true" class="movie-img" alt="rambo">
</div>
<div class="like-name">
<h3>Rambo</h3>
</div>
<div class="like-release-date">
<h3>( 2006 )</h3>
</div>
</li>
<li class="container">
<div class="like-img">
<img src="https://github.com/saedsq/MovieLibrary/blob/master/src/img/nat-1.jpg?raw=true" class="movie-img" alt="rambo">
</div>
<div class="like-name">
<h3>Rambo</h3>
</div>
<div class="like-release-date">
<h3>( 2006 )</h3>
</div>
</li>
</ul>

How do i Include 2 lines of Text (a title, and sub title), and box shadow on the images in html

How do i add text (a title and a subtitle), to the images and a box shadow behind the boxes. I have tried inserting it under the container in css, but it doesn't work.
<div class="row">
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<li class="img_wrap">
<img class="img_img" src="resources/img/posterimage.jpg" alt="POS Device">
<p class="img_description">More on this</p>
</li>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<li class="img_wrap">
<img class="img_img" src="resources/img/Router.jpg" alt="Router Device ">
<p class="img_description">More on this</p>
</li>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<li class="img_wrap">
<img class="img_img" src="resources/img/Handwashed.jpg" alt="Boy washing hands">
<p class="img_description">More on this</p>
</li>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<li class="img_wrap">
<img class="img_img" src="resources/img/Fleetos.jpg" alt="Yellow Truck">
<p class="img_description">More on this</p>
</li>
</ul>
</div>
</div>
</div>
.product-box {
width: 100%;
float: left;
display: block;
max-height: auto;
margin-bottom: 80px;
overflow: hidden;
border-bottom: 100px solid #fff;
border-radius: 3px;
cursor: pointer;
box-shadow: 20px #404040;
font-size: 90%;
margin-top: 30px;
box-sizing: border-box;
}
.img_wrap {
list-style: none;
position: relative;
box-shadow: #bcbcbc;
overflow: hidden;
margin: 0px;
width: 100%;
background-color: #000;
}
.img_description {
text-align: center;
margin-top: 30px;
font-weight: 400;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -80%);
opacity: 0;
visibility: hidden;
color: #fff;
border: 2px solid #fff;
border-spacing: 5px;
font-size: 100%;
padding: 10px;
transition: opacity 0.2s, visibility 0.2s;
}
.img_img {
width: 100%;
opacity: 1;
display: block;
height: auto;
transform: scale(1.03);
transition: transform 0.2s;
text-decoration-style: solid;
backface-visibility: hidden;
overflow: hidden;
}
.img_img:hover {
transform: scale(1.15);
opacity: 0.4;
}
.img_wrap:hover .img_description {
visibility: visible;
opacity: 1;
}
How do i add text (a title and a subtitle), to the images and a box shadow behind the boxes. I have tried inserting it under the container in css, but it doesn't work.
Do you need such a result? In the css I added rules for the .row class to line up using flex.
.row {
display: flex;
justify-content: center;
}
.product-box {
width: 100%;
float: left;
display: block;
max-height: auto;
margin-bottom: 80px;
overflow: hidden;
border-bottom: 100px solid #fff;
border-radius: 3px;
cursor: pointer;
box-shadow: 20px #404040;
font-size: 90%;
margin-top: 30px;
box-sizing: border-box;
}
.img_wrap {
list-style: none;
position: relative;
box-shadow: #bcbcbc;
overflow: hidden;
margin: 0px;
width: 100%;
background-color: #000;
}
.img_description {
text-align: center;
margin-top: 30px;
font-weight: 400;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -80%);
opacity: 0;
visibility: hidden;
color: #fff;
border: 2px solid #fff;
border-spacing: 5px;
font-size: 100%;
padding: 10px;
transition: opacity 0.2s, visibility 0.2s;
}
.img_img {
width: 100%;
opacity: 1;
display: block;
height: auto;
transform: scale(1.03);
transition: transform 0.2s;
text-decoration-style: solid;
backface-visibility: hidden;
overflow: hidden;
}
.img_img:hover {
transform: scale(1.15);
opacity: 0.4;
}
.img_wrap:hover .img_description {
visibility: visible;
opacity: 1;
}
<div class="row">
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<p>Name1</p>
<li class="img_wrap">
<img class="img_img" src="https://sun9-32.userapi.com/impf/c824201/v824201969/173424/ayWCFmi538s.jpg?size=200x0&quality=90&sign=b461a01af900c4374512c2b13455c25d&ava=1" alt="POS Device">
<p class="img_description">More on this</p>
</li>
<p>Description1</p>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<p>Name2</p>
<li class="img_wrap">
<img class="img_img" src="https://sun9-32.userapi.com/impf/c824201/v824201969/173424/ayWCFmi538s.jpg?size=200x0&quality=90&sign=b461a01af900c4374512c2b13455c25d&ava=1" alt="Router Device ">
<p class="img_description">More on this</p>
</li>
<p>Description2</p>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<p>Name3</p>
<li class="img_wrap">
<img class="img_img" src="https://sun9-32.userapi.com/impf/c824201/v824201969/173424/ayWCFmi538s.jpg?size=200x0&quality=90&sign=b461a01af900c4374512c2b13455c25d&ava=1" alt="Boy washing hands">
<p class="img_description">More on this</p>
</li>
<p>Description3</p>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<p>Name4</p>
<li class="img_wrap">
<img class="img_img" src="https://sun9-32.userapi.com/impf/c824201/v824201969/173424/ayWCFmi538s.jpg?size=200x0&quality=90&sign=b461a01af900c4374512c2b13455c25d&ava=1" alt="Yellow Truck">
<p class="img_description">More on this</p>
</li>
<p>Description4</p>
</ul>
</div>
</div>
</div>
This answer is where the name and description are under the block.
.row {
display: flex;
justify-content: center;
}
.product-box {
width: 100%;
float: left;
display: block;
max-height: auto;
margin-bottom: 80px;
overflow: hidden;
border-bottom: 100px solid #fff;
border-radius: 3px;
cursor: pointer;
box-shadow: 20px #404040;
font-size: 90%;
margin-top: 30px;
box-sizing: border-box;
}
.img_wrap {
list-style: none;
position: relative;
box-shadow: #bcbcbc;
overflow: hidden;
margin: 0px;
width: 100%;
background-color: #000;
}
.img_description {
text-align: center;
margin-top: 30px;
font-weight: 400;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -80%);
opacity: 0;
visibility: hidden;
color: #fff;
border: 2px solid #fff;
border-spacing: 5px;
font-size: 100%;
padding: 10px;
transition: opacity 0.2s, visibility 0.2s;
}
.img_img {
width: 100%;
opacity: 1;
display: block;
height: auto;
transform: scale(1.03);
transition: transform 0.2s;
text-decoration-style: solid;
backface-visibility: hidden;
overflow: hidden;
}
.img_img:hover {
transform: scale(1.15);
opacity: 0.4;
}
.img_wrap:hover .img_description {
visibility: visible;
opacity: 1;
}
<div class="row">
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<li class="img_wrap">
<img class="img_img" src="https://sun9-32.userapi.com/impf/c824201/v824201969/173424/ayWCFmi538s.jpg?size=200x0&quality=90&sign=b461a01af900c4374512c2b13455c25d&ava=1" alt="POS Device">
<p class="img_description">More on this</p>
</li>
<p>Name1</p>
<p>Description1</p>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<li class="img_wrap">
<img class="img_img" src="https://sun9-32.userapi.com/impf/c824201/v824201969/173424/ayWCFmi538s.jpg?size=200x0&quality=90&sign=b461a01af900c4374512c2b13455c25d&ava=1" alt="Router Device ">
<p class="img_description">More on this</p>
</li>
<p>Name2</p>
<p>Description2</p>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<li class="img_wrap">
<img class="img_img" src="https://sun9-32.userapi.com/impf/c824201/v824201969/173424/ayWCFmi538s.jpg?size=200x0&quality=90&sign=b461a01af900c4374512c2b13455c25d&ava=1" alt="Boy washing hands">
<p class="img_description">More on this</p>
</li>
<p>Name3</p>
<p>Description3</p>
</ul>
</div>
</div>
<div class="col span-1-of-4">
<div class="product-box">
<ul class="products-container">
<li class="img_wrap">
<img class="img_img" src="https://sun9-32.userapi.com/impf/c824201/v824201969/173424/ayWCFmi538s.jpg?size=200x0&quality=90&sign=b461a01af900c4374512c2b13455c25d&ava=1" alt="Yellow Truck">
<p class="img_description">More on this</p>
</li>
<p>Name4</p>
<p>Description4</p>
</ul>
</div>
</div>
</div>

Bootstrap 3 column gutter

I tried to fix this problem multiple times but it still occurs, I just can't find the right fix.
I cannot create gutter around columns in Bootstrap 3. Here's my Fiddle: jsfiddle.net/creuxttL
My exact problem: When I create these three columns, I expect some gutter to be between them, so they don't look like one big brick. I don't get any gutter by default, so I tried to do it manually - with css class .col . I still don't get any margin/padding around the boxes. What should I do?
You're fiddle does not have bootstrap 3 included. http://jsfiddle.net/va94exo2/ is a slight modification.
Have wrapped all of your col-md-4 content with an inner div and changed the ID="row" to class and removed your extra .col class, have also then styled the inner div.
.inner-content{
font-family: 'Roboto', sans-serif;
font-weight: 100;
color: white;
text-align: center;
background-color: #00b9ff;
border: 1px solid black;
}
.overlay-pic {
max-height: 200px;
display: block;
margin: auto;
}
.overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: #44cbff;
overflow: hidden;
width: 100%;
height: 0;
transition: .5s ease;
}
.overlay p {
font-family: 'Raleway';
font-style: italic;
white-space: nowrap;
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
.col {
/*gutter*/
padding-right: 7px;
padding-left: 7px;
}
.col:not(:first-child, :last-child) {
padding-right: 7px;
padding-left: 7px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row" style="margin-top: 10px;">
<div class="col-md-4">
<div class="inner-content">
<h1>Festival 2001</h1>
<img src="event.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Our event.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="inner-content">
<h1>Who are we?</h1>
<img src="question.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Read more about us</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="inner-content">
<h1>where, when?</h1>
<img src="calendar.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Look at our calendar.</p>
</div>
</div>
</div>
</div>
</div>
Not positive this is exactly what you're looking for but if you just want space between the rows you can add a "margin-top" attribute to your css in the ".col-md-4" class.
Hope this helps.
.col-md-4 {
font-family: 'Roboto', sans-serif;
font-weight: 100;
color: white;
text-align: center;
background-color: #00b9ff;
border: 1px solid black;
margin-top:10px;
}
.overlay-pic {
max-height: 200px;
display: block;
margin: auto;
}
.overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: #44cbff;
overflow: hidden;
width: 100%;
height: 0;
transition: .5s ease;
}
.overlay p {
font-family: 'Raleway';
font-style: italic;
white-space: nowrap;
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
.col {
/*gutter*/
padding-right: 7px;
padding-left: 7px;
}
.col:not(:first-child, :last-child) {
padding-right: 7px;
padding-left: 7px;
}
<div class="container">
<div id="row" style="margin-top: 10px;">
<div class="col-md-4 col">
<h1>Festival 2001</h1>
<img src="event.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Our event.</p>
</div>
</div>
<div class="col-md-4 col">
<h1>Who are we?</h1>
<img src="question.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Read more about us</p>
</div>
</div>
<div class="col-md-4 col">
<h1>where, when?</h1>
<img src="calendar.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Look at our calendar.</p>
</div>
</div>
</div>
</div>
Bootstrap is not added. I modified your code. And I hope you are expecting this.
.col {
font-family: 'Roboto', sans-serif;
font-weight: 100;
color: white;
text-align: center;
background-color: white;
}
.overlay-pic {
max-height: 200px;
display: block;
margin: auto;
}
.overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: #44cbff;
overflow: hidden;
width: 100%;
height: 0;
transition: .5s ease;
}
.overlay p {
font-family: 'Raleway';
font-style: italic;
white-space: nowrap;
color: white;
font-size: 20px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
.col h1{
margin-top:0px;
}
<div class="container">
<div id="row">
<div class="col-md-4 col">
<div style="margin:5px; background:#00b9ff;border: 1px solid black;">
<h1>Festival 2001</h1>
<img src="event.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Our event.</p>
</div>
</div>
</div>
<div class="col-md-4 col">
<div style="margin:5px; background:#00b9ff;border: 1px solid black;">
<h1>Who are we?</h1>
<img src="question.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Read more about us</p>
</div></div>
</div>
<div class="col-md-4 col">
<div style="margin:5px; background:#00b9ff;border: 1px solid black;">
<h1>where, when?</h1>
<img src="calendar.jpg" class="overlay-pic hidden-tablet img-responsive">
<div class="overlay">
<p>Look at our calendar.</p>
</div>
</div></div>
</div>
</div>

Make photo cover full area in hexagon shape

I have a vertical image in a hexagon responsive grid and I would like to blow it up so that the image doesn't have space on the left and right sides (shown in my code).
If someone could help me with this, that would be great as I have been having troubles trying to use both vertical and horizontal images in my grid and when coming upon vertical images, having issues getting it to fill the full hexagon without gaps on each side.
#grid {
display: flex;
flex-wrap: wrap;
width: 80%;
margin: 2% auto;
overflow: hidden;
font-size: 15px;
list-style-type: none;
}
.hexagon {
position: relative;
visibility: hidden;
outline: 1px solid transparent;
}
.hexagon::after {
content: '';
display: block;
padding-bottom: 86.602%;
}
.inside {
position: absolute;
width: 96%;
padding-bottom: 110.851%;
margin: 0 2%;
overflow: hidden;
visibility: hidden;
outline: 1px solid transparent;
-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);
}
.inside * {
position: absolute;
visibility: visible;
outline: 1px solid transparent;
}
.link {
display: block;
width: 100%;
height: 100%;
text-align: center;
overflow: hidden;
background: gray;
-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);
}
.hexagon img {
left: -100%;
right: -100%;
width: auto;
height: 100%;
margin: 0 auto;
-webkit-transform: rotate3d(0, 0, 0, 0deg);
-ms-transform: rotate3d(0, 0, 0, 0deg);
transform: rotate3d(0, 0, 0, 0deg);
}
.inner-content {
top: 49%;
left: 49%;
transform: translate(-49%, -49%);
}
.hexagon h1,
.hexagon p {
position: relative;
white-space: normal;
color: white;
}
.hexagon h1 {
font-size: 1.4em;
color: white;
text-shadow: 2px 2px #000;
}
.hexagon h1::after {
position: relative;
left: 45%;
width: 10%;
text-align: center;
}
/* sizing and row indents */
#media (min-width:1201px) {
#grid {
padding-bottom: 4.4%
}
.hexagon {
width: 20%;
}
.hexagon:nth-child(9n+6) {
margin-left: 10%;
}
}
#media (max-width: 1200px) and (min-width:901px) {
#grid {
padding-bottom: 5.5%
}
.hexagon {
width: 25%;
}
.hexagon:nth-child(7n+5) {
margin-left: 12.5%;
}
}
#media (max-width: 900px) and (min-width:601px) {
#grid {
padding-bottom: 7.4%
}
.hexagon {
width: 33.333%;
}
.hexagon:nth-child(5n+4) {
margin-left: 16.666%;
}
}
#media (max-width: 600px) {
#grid {
padding-bottom: 11.2%
}
.hexagon {
width: 50%;
}
.hexagon:nth-child(3n+3) {
margin-left: 25%;
}
}
#media (max-width: 400px) {
#grid {
font-size: 13px;
}
}
<ul id="grid">
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
</ul>
Instead of giving the images width: auto and height: 100%...
.hexagon img {
left: -100%;
right: -100%;
width: auto;
height: 100%;
margin: 0 auto;
transform: rotate3d(0,0,0,0deg);
}
Do the reverse, width: 100% and height: auto...
.hexagon img {
left: -100%;
right: -100%;
width: 100%; /* adjustment */
height: auto; /* adjustment */
margin: 0 auto;
transform: rotate3d(0,0,0,0deg);
}
#grid {
display: flex;
flex-wrap: wrap;
width: 80%;
margin: 2% auto;
overflow: hidden;
font-size: 15px;
list-style-type: none;
}
.hexagon {
position: relative;
visibility: hidden;
outline: 1px solid transparent;
}
.hexagon::after {
content: '';
display: block;
padding-bottom: 86.602%;
}
.inside {
position: absolute;
width: 96%;
padding-bottom: 110.851%;
margin: 0 2%;
overflow: hidden;
visibility: hidden;
outline: 1px solid transparent;
-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);
}
.inside * {
position: absolute;
visibility: visible;
outline: 1px solid transparent;
}
.link {
display: block;
width: 100%;
height: 100%;
text-align: center;
overflow: hidden;
background: gray;
-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);
}
.hexagon img {
left: -100%;
right: -100%;
width: 100%; /* adjustment */
height: auto; /* adjustment */
margin: 0 auto;
-webkit-transform: rotate3d(0, 0, 0, 0deg);
-ms-transform: rotate3d(0, 0, 0, 0deg);
transform: rotate3d(0, 0, 0, 0deg);
}
.inner-content {
top: 49%;
left: 49%;
transform: translate(-49%, -49%);
}
.hexagon h1,
.hexagon p {
position: relative;
white-space: normal;
color: white;
}
.hexagon h1 {
font-size: 1.4em;
color: white;
text-shadow: 2px 2px #000;
}
.hexagon h1::after {
position: relative;
left: 45%;
width: 10%;
text-align: center;
}
/* sizing and row indents */
#media (min-width:1201px) {
#grid {
padding-bottom: 4.4%
}
.hexagon {
width: 20%;
}
.hexagon:nth-child(9n+6) {
margin-left: 10%;
}
}
#media (max-width: 1200px) and (min-width:901px) {
#grid {
padding-bottom: 5.5%
}
.hexagon {
width: 25%;
}
.hexagon:nth-child(7n+5) {
margin-left: 12.5%;
}
}
#media (max-width: 900px) and (min-width:601px) {
#grid {
padding-bottom: 7.4%
}
.hexagon {
width: 33.333%;
}
.hexagon:nth-child(5n+4) {
margin-left: 16.666%;
}
}
#media (max-width: 600px) {
#grid {
padding-bottom: 11.2%
}
.hexagon {
width: 50%;
}
.hexagon:nth-child(3n+3) {
margin-left: 25%;
}
}
#media (max-width: 400px) {
#grid {
font-size: 13px;
}
}
<ul id="grid">
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
<li class="hexagon">
<div class="inside">
<a class="link" href="">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Flatiron_Building_3618433845_5745ebc1b9.jpg/220px-Flatiron_Building_3618433845_5745ebc1b9.jpg" alt="" />
<div class="inner-content">
<h1>title</h1>
</div>
</a>
</div>
</li>
</ul>