Sup guys. I can't make bew page with blocks to be in the same way as they are meant to be. I have problem with this high block, called "Bags". I tried flex-box, I tried float. Maybe someone can help me in placing everything in the way it was meant to be.
figcaption
{
position: absolute;
width: 100%;
height: 41px;
bottom: 0px;
padding-top: 13px;
padding-left: 20px;
font-size: 21.333px;
font-family: "SegoeUIBold";
opacity: 0.8;
background-color: #FFF;
}
figure
{
position: relative;
cursor: pointer;
float: left;
margin-right: 10px;
margin-bottom: 10px;
}
<main>
<figure class="huge">
<img src="img/greenTshirt.png" alt="">
<figcaption>T-Shirts</figcaption>
</figure>
<figure class="normal">
<img src="img/cards.png" alt="">
<figcaption>Cards</figcaption>
</figure>
<figure class="normal">
<img src="img/pens.png" alt="">
<figcaption>Pens & Pencils</figcaption>
</figure>
<figure class="wide">
<img src="img/notebooks.png" alt="">
<figcaption>Notebooks</figcaption>
</figure>
<figure class="normal">
<img src="img/toys.png" alt="">
<figcaption>Toys</figcaption>
</figure>
<figure class="high">
<img src="img/bags.png" alt="">
<figcaption>Bags</figcaption>
</figure>
<figure class="normal">
<img src="img/scrum.png" alt="">
<figcaption>Scrum cards</figcaption>
</figure>
<figure class="normal">
<img src="img/magnets.png" alt="">
<figcaption>Magnets</figcaption>
</figure>
<figure class="big">
<img src="img/redCaps.png" alt="">
<figcaption>Caps</figcaption>
</figure>
<figure class="normal">
<img src="img/magnets.png" alt="">
<figcaption>Magnets</figcaption>
</figure>
<figure class="normal">
<img src="img/pens.png" alt="">
<figcaption>Pens & Pencils</figcaption>
</figure>
<figure class="normal">
<img src="img/toys.png" alt="">
<figcaption>Toys</figcaption>
</figure>
</main>
Images:
Model
Result
Try the code below instead the one you are trying.
CSS:
figcaption {
position: absolute;
width: 100%;
height: 41px;
bottom: 0px;
padding-top: 13px;
padding-left: 20px;
font-size: 21.333px;
font-family: "SegoeUIBold";
opacity: 0.8;
background-color: #FFF;
}
figure {
position: relative;
padding: 5em;
cursor: pointer;
float: left;
margin-right: 10px;
margin-bottom: 10px;
}
HTML:
<main>
<figure>
<img src="img/greenTshirt.png" alt="">
<figcaption>T-Shirts</figcaption>
</figure>
<figure>
<img src="img/cards.png" alt="">
<figcaption>Cards</figcaption>
</figure>
<figure>
<img src="img/pens.png" alt="">
<figcaption>Pens & Pencils</figcaption>
</figure>
<figure>
<img src="img/notebooks.png" alt="">
<figcaption>Notebooks</figcaption>
</figure>
<figure>
<img src="img/toys.png" alt="">
<figcaption>Toys</figcaption>
</figure>
<figure>
<img src="img/bags.png" alt="">
<figcaption>Bags</figcaption>
</figure>
<figure>
<img src="img/scrum.png" alt="">
<figcaption>Scrum cards</figcaption>
</figure>
<figure>
<img src="img/magnets.png" alt="">
<figcaption>Magnets</figcaption>
</figure>
<figure>
<img src="img/redCaps.png" alt="">
<figcaption>Caps</figcaption>
</figure>
<figure>
<img src="img/magnets.png" alt="">
<figcaption>Magnets</figcaption>
</figure>
<figure>
<img src="img/pens.png" alt="">
<figcaption>Pens & Pencils</figcaption>
</figure>
<figure>
<img src="img/toys.png" alt="">
<figcaption>Toys</figcaption>
</figure>
</main>
and if you want to increase the size of the image, you can do it and then increase the padding in the css.
Related
I'm trying to have 3 figures side by side, each containing an image (that has a link in it), and a caption that's centered on the top of the image.
So far, I've got this:
figure {
display: table;
width: 50%;
margin:0;
}
figcaption {
display: table-caption;
caption-side: top;
}
#content {
max-width: 80%;
height: 80%;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: auto;
text-align: center;
}
<div id="content" class="center">
<div>
<figure style="float:left;">
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" width="30%">
</a>
<figcaption style="text-align:center">Cute cat </figcaption>
</figure>
<figure>
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat 2" width="30%">
</a>
<figcaption style="text-align:center">Cute cat 2 </figcaption>
</figure>
</div>
</div>
But when I try to add a third (or fourth, for that matter) image, the whole thing malfunctions.
I've tried using style="float:right; on the third image, which leads to it being below the other 2 figures on another line(of course, after reducing the width of figure first).
Essentially what I want the end result to be is to be able to put any number of images (3 and 4 for my use, but generalizing the solution will help people with the same problem) side by side, while each image has some text over it (hence the figure and figcaption CSS rules, which display the figcaption above the picture)
.flex{display: flex;}
figure {
display: table;
width: 50%;
margin:0;
}
figcaption {
display: table-caption;
caption-side: top;
}
#content {
max-width: 80%;
height: 80%;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: auto;
text-align: center;
}
<div id="content" class="center">
<div class="flex">
<figure >
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" width="30%">
</a>
<figcaption style="text-align:center">Cute cat </figcaption>
</figure>
<figure >
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" width="30%">
</a>
<figcaption style="text-align:center">Cute cat </figcaption>
</figure>
<figure >
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" width="30%">
</a>
<figcaption style="text-align:center">Cute cat </figcaption>
</figure>
<figure >
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" width="30%">
</a>
<figcaption style="text-align:center">Cute cat </figcaption>
</figure>
<figure>
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat 2" width="30%">
</a>
<figcaption style="text-align:center">Cute cat 2 </figcaption>
</figure>
</div>
</div>
For 3-4 image you can provide width to the element. But you can show a defined number of images using width. To show n number of image you can show as table and use css property overflaw:scroll.
figure {
display: table;
width: 50%;
margin:0;
}
figcaption {
display: table-caption;
caption-side: top;
}
#content {
max-width: 80%;
height: 80%;
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: auto;
text-align: center;
}
<div id="content" class="center">
<div>
<figure style="float:left; width:25%">
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" width="30%">
</a>
<figcaption style="text-align:center">Cute cat </figcaption>
</figure>
<figure style="float:left; width:25%">
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat 2" width="30%">
</a>
<figcaption style="text-align:center">Cute cat 2 </figcaption>
</figure>
<figure style="float:left; width:25%">
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" width="30%">
</a>
<figcaption style="text-align:center">Cute cat </figcaption>
</figure>
<figure style="float:left; width:25%">
<a href="#">
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat 2" width="30%">
</a>
<figcaption style="text-align:center">Cute cat 2 </figcaption>
</figure>
</div>
</div>
firstly remove float and use display: flex;, it is very useful and highly recommended one.
and change the code to like this
#container {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.item {
width: 20%;
display: block;
align-items: center;
justify-content: center;
border: 1px solid;
}
.link {
text-decoration: none;
color: #000;
}
.image-container {
display: inline-block;
width: 100%;
}
.caption {
text-align: center;
}
<div id="container">
<div class="item">
<a href="#" class="link">
<h3 class="caption">Cute cat </h3>
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" class="image-container">
</a>
</div>
<div class="item">
<a href="#" class="link">
<h3 class="caption">Cute cat </h3>
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat" class="image-container">
</a>
</div>
<div class="item">
<a href="#" class="link">
<h3 class="caption">Cute cat </h3>
<img src="https://i.guim.co.uk/img/media/26392d05302e02f7bf4eb143bb84c8097d09144b/446_167_3683_2210/master/3683.jpg?width=445&quality=45&auto=format&fit=max&dpr=2&s=42132184edabf489cb379824f3da6f61" loading="lazy" alt="cat 2" class="image-container">
</a>
</div>
</div>
Hi I'm trying to make a site of images from our family holidays and it has a page with folders that has one image from every day that I can click on each image and be take to a different page with all the images from that day.
Everything looks good but I want to add a border to each image on the folders page, and I want the border should look like a folder, with the top right side should be a bit higher than the left side etc.
I tried playing around with some tooltip css styles that has like an arrow coming out from it, but it didn't work.
Hope this question is clear enough, it is the best I can describe my problem.
<div class="container">
<div class="row">
<div class="col-lg-3">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
</div>
<div class="col-lg-3">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
</div>
<div class="col-lg-3">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
</div>
<div class="col-lg-3">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
<img src="image1200.jpg" class="img-fluid img" alt="">
</div>
</div>
</div>
and the css
.img {
border: black 5px solid;
position: relative;
margin: 5px;
}
.img:hover {
cursor: pointer;
opacity: .8;
box-shadow: 0 0 5px 3px rgba(0, 140, 186, 0.5);
}
.img::before {
content: " ";
position: absolute;
bottom: 100%;
left: 0;
margin-right: -5px;
border-width: 10px;
border-style: solid;
border-color: black transparent black transparent;
}
Thanks for your nice Question.
Please, try the below code. I fix this via some CSS code. I hope it will be work which is you find.
.container {
display: flex;
}
.folder {
width: 150px;
height: 105px;
margin: 0 auto;
margin-top: 50px;
position: relative;
background-color: #708090;
border-radius: 0 6px 6px 6px;
box-shadow: 4px 4px 7px rgba(0, 0, 0, 0.59);
}
.folder:before {
content: '';
width: 50%;
height: 12px;
border-radius: 0 20px 0 0;
background-color: #708090;
position: absolute;
top: -12px;
left: 0px;
}
<!DOCTYPE html>
<html>
<head>
<title>Folder via HTML & CSS By Monzur Alam</title>
</head>
<body>
<div class="container">
<div class="folder">
<img src="https://cdn.sstatic.net/Img/teams/teams-illo-free-sidebar-promo.svg?v=47faa659a05e" />
</div>
<div class="folder">
<img src="https://cdn.sstatic.net/Img/teams/teams-illo-free-sidebar-promo.svg?v=47faa659a05e" />
</div>
<div class="folder">
<img src="https://cdn.sstatic.net/Img/teams/teams-illo-free-sidebar-promo.svg?v=47faa659a05e" />
</div>
</div>
</body>
</html>
I've built a gallery layout. Each <div class="gallery"> section fills the viewport. Here's how it looks without a sticky header. The layout works as expected using this method.
body {
margin: 0;
font-size: 16px;
font-size: 1rem;
line-height: 1.5;
}
header,
footer {
padding: 48px;
color: #fff;
background-color: #000;
}
.gallery {
display: flex;
height: 100vh;
}
.gallery figure {
flex: 1;
margin: 0;
}
.gallery figure img {
display: block;
/* Make images responsive */
height: auto;
max-width: 100%;
/* Fill .gallery width and height */
width: 100%;
height: 100vh;
object-fit: cover;
}
<header>
<span>Header</span>
</header>
<div class="gallery">
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
</div>
<div class="gallery">
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
</div>
<footer>
<span>Footer</span>
</footer>
Next, I've added a sticky header, like so.
body {
margin: 0;
font-size: 16px;
font-size: 1rem;
line-height: 1.5;
}
header,
footer {
padding: 48px;
color: #fff;
background-color: #000;
}
header {
position: sticky;
top: 0;
}
.gallery {
display: flex;
height: calc(100vh - 120px);
}
.gallery figure {
flex: 1;
margin: 0;
}
.gallery figure img {
display: block;
/* Make images responsive */
height: auto;
max-width: 100%;
/* Fill .gallery width and height */
width: 100%;
height: 100vh;
object-fit: cover;
}
<header>
<span>Header</span>
</header>
<div class="gallery">
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
</div>
<div class="gallery">
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
</div>
<footer>
<span>Footer</span>
</footer>
To account for the sticky header, I've added height: calc(100vh - 120px); to .gallery. This works for the first .gallery parent, but something funky is happening with the last parent .gallery. As you can see, the footer overlaps.
EDIT
If you inspect <figure> on the sticky header example, you'll notice that it's correctly calculating the height. For example, at a resolution of 1366x768, the height of <figure> measures 648px in height (768px - 120px). However, the <a> and <img> elements show a height of 768px.
How can I fix this?
As per my edit, the problem lies with the the <a> and <img> elements not being contained with the <figure> element. I've resolved this by adding height: 100%; to .gallery figure a and .gallery figure img.
body {
margin: 0;
font-size: 16px;
font-size: 1rem;
line-height: 1.5;
}
img {
height: auto;
max-width: 100%;
}
header,
footer {
padding: 48px;
color: #fff;
background-color: #000;
}
.gallery {
display: flex;
height: 100vh;
}
.gallery figure {
flex: 1;
margin: 0;
}
.gallery figure a,
.gallery figure img {
display: block;
height: 100%; /* Fills the height of <figure> */
}
.gallery figure img {
object-fit: cover;
}
<header>
<span>Header</span>
</header>
<div class="gallery">
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
</div>
<div class="gallery">
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
<figure>
<a href="#" class="lightbox">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Yawning_cat_portrait_%288423278464%29.jpg/1200px-Yawning_cat_portrait_%288423278464%29.jpg" alt="Cat">
</a>
</figure>
</div>
<footer>
<span>Footer</span>
</footer>
i have come across a problem that i cant seem to solve,
on my 23" monitor the page shows the content, how ever on my laptop screen 14" it does not show all the content, i can scroll a bit but not all the way to see the res of the page, any thugs?
body {
font-family: Arial, Verdana, sans-serif;
background-color: #141414;
color: #fff;
font-size: 90%;
margin: 0px;
padding: 0px;
}
img#logo {
width: 250px;
position: relative;
bottom: 0px;
left: 10px;
border: none;
}
div#nav {
background-color: rgba(7, 7, 7, 0.7);
box-shadow: 0px 3px 10px #000;
height: 70px;
position: fixed;
top: 0px;
left: 0px;
padding: 10px;
margin: 0px;
width: 100%;
}
div#division {
margin-top: 120px;
}
.octo {
position: fixed;
right: 0px;
width: 100%;
height: 100%;
margin-bottom: 100px;
}
.wraper {
margin: 10px auto 10px auto;
width: 1200px;
padding-left: 100px;
}
.poster {
display: inline-block;
width: 273px;
}
figure {
background-color: rgba(106, 192, 69, 0.7);
border-radius: 5px;
padding-left: 3px;
}
img {
}
figcaption {
font-weight: bold;
padding-left: 5px;
}
figure:hover {
background-color: #1ba6e0;
border-radius: 5px;
}
<!DOCTYPE html>
<html>
<head>
<title>Rewind HD</title>
<link rel="stylesheet" type="text/css" href="CSS/rewind hd.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="nav">
<img id="logo" src="images/REWIND HD web.png">
</div>
<div id="division"></div>
<div class="wraper">
<div class="poster">
<figure>
<figcaption>James Bond<br /> Octopussy</figcaption>
<img src="images/octopussy.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> A View To A Kill</figcaption>
<img src="images/JBAVTK.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> For Your Eyes Only</figcaption>
<img src="images/James Bond For Your Eyes Only.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Licence To Kill</figcaption>
<img src="images/James Bond Licence To Kill.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Moonraker</figcaption>
<img src="images/James Bond Moonraker.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Never Say Never Again</figcaption>
<img src="images/James Bond Never Say Never Again.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Majestys Secret Service</figcaption>
<img src="images/James Bond On Her Majestys Secret Service.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> The Living Daylights</figcaption>
<img src="images/James Bond The Living Daylights.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> The Spy Who Loved</figcaption>
<img src="images/James Bond The Spy Who Loved.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>ames Bond<br /> Licence To Kill</figcaption>
<img src="images/James Bond Licence To Kill.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Moonraker</figcaption>
<img src="images/James Bond Moonraker.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Never Say Never Again</figcaption>
<img src="images/James Bond Never Say Never Again.jpg" class="background_color">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>ames Bond<br /> Licence To Kill</figcaption>
<img src="images/James Bond Licence To Kill.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Moonraker</figcaption>
<img src="images/James Bond Moonraker.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Never Say Never Again</figcaption>
<a href="James Bond Never Say Never Again.html"><img src="images/James Bond Never Say Never Again.jpg"
</figure>
</div>
</div>
</body>
</html>
***strong text***
I think you want something like this:
first, change width of wrapper to 85% for have fluid wrapper.
then add float:left to .poster class.
the code is here ( you have a little responsive page):
<!DOCTYPE html>
<html>
<head>
<title>Rewind HD</title>
<link rel="stylesheet" type="text/css" href="CSS/rewind hd.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, Verdana, sans-serif;
background-color: #141414;
color: #fff;
font-size: 90%;
margin: 0px;
padding: 0px;
}
img#logo {
width: 250px;
position: relative;
bottom: 0px;
left: 10px;
border: none;
}
div#nav {
background-color: rgba(7, 7, 7, 0.7);
box-shadow: 0px 3px 10px #000;
height: 70px;
position: fixed;
top: 0px;
left: 0px;
padding: 10px;
margin: 0px;
width: 100%;
}
div#division {
margin-top: 120px;
}
.octo {
position: fixed;
right: 0px;
width: 100%;
height: 100%;
margin-bottom: 100px;
}
.wraper {
margin: 10px auto 10px auto;
width: 85%;
padding-left: 100px;
}
.poster {
display: inline-block;
width: 273px;
float:left;
}
figure {
background-color: rgba(106, 192, 69, 0.7);
border-radius: 5px;
padding-left: 3px;
}
img {
}
figcaption {
font-weight: bold;
padding-left: 5px;
}
figure:hover {
background-color: #1ba6e0;
border-radius: 5px;
}
</style>
</head>
<body>
<div id="nav">
<img id="logo" src="images/REWIND HD web.png">
</div>
<div id="division"></div>
<div class="wraper">
<div class="poster">
<figure>
<figcaption>James Bond<br /> Octopussy</figcaption>
<img src="images/octopussy.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> A View To A Kill</figcaption>
<img src="images/JBAVTK.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> For Your Eyes Only</figcaption>
<img src="images/James Bond For Your Eyes Only.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Licence To Kill</figcaption>
<img src="images/James Bond Licence To Kill.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Moonraker</figcaption>
<img src="images/James Bond Moonraker.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Never Say Never Again</figcaption>
<img src="images/James Bond Never Say Never Again.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Majestys Secret Service</figcaption>
<img src="images/James Bond On Her Majestys Secret Service.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> The Living Daylights</figcaption>
<img src="images/James Bond The Living Daylights.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> The Spy Who Loved</figcaption>
<img src="images/James Bond The Spy Who Loved.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>ames Bond<br /> Licence To Kill</figcaption>
<img src="images/James Bond Licence To Kill.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Moonraker</figcaption>
<img src="images/James Bond Moonraker.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Never Say Never Again</figcaption>
<img src="images/James Bond Never Say Never Again.jpg" class="background_color">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>ames Bond<br /> Licence To Kill</figcaption>
<img src="images/James Bond Licence To Kill.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Moonraker</figcaption>
<img src="images/James Bond Moonraker.jpg">
</figure>
</div>
<div class="poster">
<figure>
<figcaption>James Bond<br /> Never Say Never Again</figcaption>
<a href="James Bond Never Say Never Again.html"><img src="images/James Bond Never Say Never Again.jpg"
</figure>
</div>
</div>
</body>
</html>
I have boxes which size is 33.33% that is why 3 boxes are making 100% totaly.when I added fourth div and my 4th div is slipping whenever I putted .clearfix my problem is over..but I want to put clearfix every each 3rd div
thanks.
ok.. #AndreiGheorghiu my codes;
.ref-box {
position: relative;
width: 30%;
float: left;
margin: 10px 3.3% 10px 0;
}
.ref-item {
width: 100%;
position: absolute;
bottom: 0;
padding: 7px;
color: #FFFFFF;
background: rgba(242, 102, 81, .8);
}
.ref-box figure a img {
display: block;
max-height: 100%;
}
.ref-box:nth-child(3n+3):after {
content: "";
display: table;
clear: both;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="works/Facebook/thumbnail.jpg" height="451" width="500" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<!-- every ref item-->
copy this code more than one and see the result
.parent>.child:nth-child(3n) {
clear: both;
}
UPDATE, after question being completed:
Your clearfix is working fine. Here:
.ref-box {
position: relative;
width: 30%;
float: left;
margin: 10px 3.3% 10px 0;
}
.ref-item {
width: 100%;
position: absolute;
bottom: 0;
padding: 7px;
color: #FFFFFF;
background: rgba(242, 102, 81, .8);
}
.ref-box figure a img {
display: block;
max-height: 100%;
}
.ref-box:nth-child(3n+3):after {
content: "";
display: table;
clear: both;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="works/Facebook/thumbnail.jpg" height="451" width="500" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="works/Facebook/thumbnail.jpg" height="451" width="500" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="works/Facebook/thumbnail.jpg" height="451" width="500" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="works/Facebook/thumbnail.jpg" height="451" width="500" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="works/Facebook/thumbnail.jpg" height="451" width="500" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="works/Facebook/thumbnail.jpg" height="451" width="500" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="works/Facebook/thumbnail.jpg" height="451" width="500" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<!-- every ref item-->
Second update, after seeing the live page. Your problem is you are floating elements of uneven heights.
Updated again, after seeing the live example. Please not I added a custom class (.makeColumns) to your col-md-12 container. I also added this to CSS:
.makeColumns {
-webkit-columns: 300px 3;
-moz-columns: 300px 3;
columns: 300px 3;
}
h2 {
-webkit-column-span: all;
column-span: all;
}
You can see it working here:
.makeColumns {
-webkit-columns: 300px 3;
-moz-columns: 300px 3;
columns: 300px 3;
}
h2 {
-webkit-column-span: all;
column-span: all;
}
.ref-box {
position: relative;
margin: 10px 3.3% 10px 0;
}
.ref-item {
width: 100%;
position: absolute;
bottom: 0;
padding: 7px;
color: #FFFFFF;
background: rgba(242, 102, 81, .8);
}
.ref-box figure a img {
display: block;
max-height: 100%;
}
.ref-box:nth-child(3n+3):after {
content: "";
display: table;
clear: both;
}
<div class="section references" id="references">
<div class="row">
<div class="col-md-12 makeColumns">
<h2 class="head"><i class="fa fa-code"></i> References</h2>
<!-- <p>
This page will be designed soon. for now click here to see his references
</p>-->
<div class="ref-box">
<figure>
<a href="works/nartasarim/index.html" title="created with bootstrap" target="_blank">
<img src="http://cv.firatabak.com/works/nartasarim/thumbnail.jpg" alt="Nar Tasarım" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Nar Tasarım</span>
</div>
</div>
<!-- every ref item-->
<div class="ref-box">
<figure>
<a href="works/ElZero/index.html" title="created with bootstrap" target="_blank">
<img src="http://cv.firatabak.com/works/ElZero/thumbnail.jpg" alt="El Zero" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">El Zero</span>
</div>
</div>
<!-- every ref item-->
<div class="ref-box">
<figure>
<a href="works/Singolo/index.html" title="created with bootstrap" target="_blank">
<img src="http://cv.firatabak.com/works/Singolo/thumbnail.jpg" alt="Singolo" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Singolo</span>
</div>
</div>
<!-- every ref item-->
<div class="ref-box">
<figure>
<a href="works/Facebook/index.html" title="created html-css" target="_blank">
<img src="http://cv.firatabak.com/works/Facebook/thumbnail.jpg" alt="Facebook Clone" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Facebook Clone</span>
</div>
</div>
<!-- every ref item-->
<div class="ref-box">
<figure>
<a href="works/nartasarim/index.html" title="created with bootstrap" target="_blank">
<img src="http://cv.firatabak.com/works/nartasarim/thumbnail.jpg" alt="Nar Tasarım" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Nar Tasarım</span>
</div>
</div>
<!-- every ref item-->
<div class="ref-box">
<figure>
<a href="works/nartasarim/index.html" title="created with bootstrap" target="_blank">
<img src="http://cv.firatabak.com/works/nartasarim/thumbnail.jpg" alt="Nar Tasarım" class="img-responsive">
</a>
</figure>
<div class="ref-item">
<span class="ref-head">Nar Tasarım</span>
</div>
</div>
<!-- every ref item-->
</div>
</div>
</div>
you can write css for that like given bellow
div:nth-child(3n+3) {
clear: both;
}
Alternatively, you can use overflow: hidden;