0

I'm aiming for a page with a collage of 4 photos; a large one on the left taking up 50% width of the page and 100% of the height. 3 smaller photos, each taking up 50% of the width of the page but 33% of the height.

I'm running into problems with the larger image though,

my current CSS is;

.container {
width: 50%;
height: 100%;
overflow: hidden;
-size: cover;
}

and my html;

  <div class="container">
<img height="100%" width="100%" src="jpg"></img>
</div>

the image's 50% width is fine but the height is only 50%. It's a large image(4k) and my aim was to have overflow:hidden so that it fills the container but it's not working.

How could I do this?

Edit:

I'm aiming for it to be similar to this website:

http://www.masitupungato.com/

3 Answers 3

1

Suggested Solution

In fact, it is the easiest solution

Use two different divs, one for the left side and the other for the right side.

The left side div takes the half of the container width, and contains a image

The right side div takes the half of the container width, and contains 3 different divs, each one takes 33% of this right div height, and contains an image.

Use the CSS below:

.container {
    width: 250px;
    height: 250px;
    margin: auto;
}

#left {
    width: 50%;
    float: left;
    height: 100%;
}

#right {
    width: 50%;
    float: left;
    height: 100%;
}

.right-inner{
    width: 100%;
    height: 33%;
}

.left-inner {
  width: 100%;
    height: 100%;
}

Expected output

enter image description here

Check it out.

Sign up to request clarification or add additional context in comments.

Comments

0

You might change the height of the biggest image to fit the window of the device. Try to to set its height to "100vh", maybe it is what you were looking for.

Comments

0

you can use display:flex; property for this purpose. it will resolve your issue dynamically.

<div class="wrapper">
<div class="big-image">
<img src="http://static.independent.co.uk/s3fs-public/styles/story_medium/public/thumbnails/image/2013/07/31/10/A-striped-field-mouse-(Apod.jpg" alt="">
</div>
<div class="small-image-wrapper">
<div class="image">
  <img src="http://static.independent.co.uk/s3fs-public/styles/story_medium/public/thumbnails/image/2013/07/31/10/A-striped-field-mouse-(Apod.jpg" alt="">
</div>
    <div class="image">
  <img src="http://static.independent.co.uk/s3fs-public/styles/story_medium/public/thumbnails/image/2013/07/31/10/A-striped-field-mouse-(Apod.jpg" alt="">
</div>
    <div class="image">
  <img src="http://static.independent.co.uk/s3fs-public/styles/story_medium/public/thumbnails/image/2013/07/31/10/A-striped-field-mouse-(Apod.jpg" alt="">
</div>

here is the fiddle https://jsfiddle.net/d95hw8fq/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.