Display 4 images in a vertical layout without any padding, while ensuring responsiveness

Thank you to everyone for all the help! I have learned so much from your continuous support.

I am working on creating a 4-way vertical "collage" of images with no spaces between each picture, that is fully responsive when resizing the window. However, I am struggling to eliminate the space between each photo.

Another issue arises when I resize the window smaller, causing the images to move away from the lion image above and create more white space or padding without aligning with the lion image. The images also start overlapping the lion image when resizing to a larger size.

.image {
  background-image: url(https://s-media-cache-ak0.pinimg.com/originals/31/91/d7/3191d75f03ba7d4c570358870c855ed7.jpg);
  background-repeat: no-repeat;
  height: 850px;
  background-size: 100%;
}

#collage {
  width: 90%;
}
<div class="image">
  <ul id="nav">
    <li id="brand"><a href="#">MINIMAL</a></li>
    <li id="navm"><a href="#">Men</a></li>
    <li id="navm"><a href="#">Women</a></li>
    <li id="navm"><a href="#">Contact</a></li>
  </ul>

  <h1>Simplicity is Minimal</h1>

  <div id="home">
    <a href="#" id="homeb">Shop Now</a>
  </div>
</div>

<div class="row">
  <div class="col-md-3" align="center">
    <img id="collage" src="https://upload.wikimedia.org/wikipedia/commons/2/27/Panthera_tiger_in_a_marshy_area_in_captivity.jpg">
  </div>

  <div class="col-md-3" align="center">
    <img id="collage" src="https://upload.wikimedia.org/wikipedia/commons/2/27/Panthera_tiger_in_a_marshy_area_in_captivity.jpg">
  </div>

  <div class="col-md-3" align="center">
    <img id="collage" src="https://upload.wikimedia.org/wikipedia/commons/2/27/Panthera_tiger_in_a_marshy_area_in_captivity.jpg">
  </div>

  <div class="col-md-3" align="center">
    <img id="collage" src="https://upload.wikimedia.org/wikipedia/commons/2/27/Panthera_tiger_in_a_marshy_area_in_captivity.jpg">
  </div>


</div>

Answer №1

To achieve the desired outcome, simply implement the following CSS code:

*{
    margin:0px;
    padding:0px;
}
.image {
    height: auto;
}
body img {
    display: block;
}`

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to display content at a specific time using Angular?

Whenever a user searches something and no results are found, I display a message. However, when there is content to show, an error message pops up for about 3-4 seconds before disappearing and showing the search results. This is my HTML: <div> &l ...

Trouble displaying data with Angular 6 JSON object pipe

Having an issue with displaying tasks from a MongoDB project schema in HTML. The tasks are stored in a nested array and I want to show the task name and description. Here's the code: <div class="card-body"> {{project.taskName | json}} </ ...

Drag Bootstrap panels to the edge of the column

I need to position two panels in a column, with one on the left and the other on the right. Currently, they are not aligned properly, as shown in this image: https://i.stack.imgur.com/RU636.png The first panel should be moved to the left to align with the ...

Enhancing your Vue web application with Bootstrap: A guide to customization

Utilizing bootstrap-4 within my Vue web application has been challenging. I am unable to customize it as explained here. My index.html utilizes Bootstrap CDN, as shown below: <!DOCTYPE html> <html lang="en"> <head> <meta charse ...

What is the best way to make a DIV box span the entire webpage without overflowing to the left?

I am currently working on a client's website and running into some issues with the layout of the booking page. The address is supposed to be on the left side, the contact form on the right, and both should be contained within a white box that fills th ...

Creating a Search Functionality within a Tab Component in Ionic

I'm currently facing an issue with adding a search bar under the "Search" tab in my project. I've tried implementing similar logic to what's shown here, but it doesn't seem to function properly when using the ionic serve --lab live in-b ...

Can a stroke in an SVG image be created using a gradient color?

Is it possible to create a gradient in the stroke color of these two lines, currently set to #389967, within this SVG? .chart-three svg .circle-foreground { stroke: #389967; stroke-dasharray: 494.55px 549.5px; stroke-dashoffset: 494.55px; stroke- ...

The spinning wheel goes round and round while executing the location.reload() function

Currently, I am performing actions in my JavaScript function and then triggering a page refresh using location.reload(); I'm wondering if there is a straightforward method with jQuery to display a spinning wheel from the moment the page initiates the ...

Choose all the checkboxes and set the value of the selected checkbox to 'on' using jQuery

Here is my JSFiddle demonstration featuring a scenario where there are 3 checkboxes. My goal is to assign the value "on" to the selected checkbox, while the unchecked ones should have a value of "off". Initially, I set all checkboxes to have a default va ...

Adding hue to the portion of text following a JavaScript split() operation

I need assistance in printing the text entered in a textarea with different colors. I am separating the string using the split() method, which works fine. However, I now want to print the substrings in the textarea with colors. How can this be achieved? & ...

HTML and CSS3 - styling a curved path

Can someone assist me in creating a curved line with fading edges using css3/html5, similar to the design shown in this image https://i.sstatic.net/8GFk6.png I came across this example on CodePen, but the edges are not fading as I would like them to. .bo ...

The orientation of my bootstrap navbar menu is vertical instead of horizontal

I've been struggling with this issue for hours now. Despite searching online for solutions, I haven't been able to make my navbar list go vertical or get the "logout" and "My Posts" options to drop down when "Author" is selected as it should. Her ...

I am unable to utilize folder paths in CSS within my React application

Having trouble setting a background image in CSS within my React app. When styling and setting the image from a React component, it works just fine. Can anyone provide assistance? This code snippet will work: const style={ width:'300px', ...

Creating HTML forms allows for images to be used as checkboxes

I'm attempting to convert an HTML forms checkbox into a clickable image that changes its appearance when clicked. Additionally, I need it to be capable of storing one or two variables (specifically for generating them with row and column values) and f ...

Issue encountered with sortable table in list.js

Encountering a puzzling error while implementing list.js and tabletop for a sortable table sourced from a Google Doc. The error message reads: "Uncaught TypeError: Cannot read property 'childNodes' of undefined," pinpointing the first line in lis ...

Struggling to implement a vertical scroll bar in HTML code?

<body ng-app="myApp" ng-controller="myCtrl"> <div ng-show = "dataFromRest" ng-repeat = "x in dataFromRest.posts" > <div class="tittle" style="width: 25%;"> <a href="" ng-click="showDi ...

Disabled text selection in Internet Explorer

I am in need of making one HTML element (Label) unselectable for IE. I have tried using the following methods: Unselectable=on onselectreturn=false; Unfortunately, none of these solutions are working for me. For Firefox and Chrome, I've successful ...

How can I address the variations in CSS appearance between Firefox and Google Chrome?

I'm currently working on a table with two cells in each row just for fun. For the first row, I want both cells to display the same picture. To achieve this, I wrote the following CSS: tr:nth-child(1){ background-image:url("cat.jpg"); background-size: ...

What is the best way to achieve a seamless CSS transition for my sticky navigation bar?

Looking to create a sticky bar with a smooth CSS transition instead of the current rough effect. Any tips or hints would be greatly appreciated! For reference, I found the exact animation I'm aiming for on this website: https://css-tricks.com/ Here i ...

Navbar active class not updating on jQuery page scroll

My one-page website has a fixed navbar that I want to change its active status when scrolling down to specific div positions. Even though I tried using jQuery, the code doesn't seem to work as intended. Here is the snippet: // SMOOTH SCROLLING PAGES ...