What is the best way to line up three logos in a row across the full width of the display and maintain their alignment on smaller screens?

I'm attempting to align three logos of the same height but different widths on a row spanning the entire screen width. The first logo should be aligned at the left end of the screen, the third one at the right end, and the second logo should float between them with equal spacing. The space between logos should decrease as the display size shrinks until it reaches a defined minimum space. Beyond that point, if the display continues to shrink, the entire row should scale down. Please refer to the image below for a visual representation.

View how it should look here

This layout is intended for use in a MailChimp Newsletter.

Here is my current progress:

.my-logo-container{
  width: 100%;
  height: 80px;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
}

.my-logos{
flex: 1;
border: 1px solid red;
height: auto;
max-height: 100px;
}
<div class="my-logo-container">
  <div class="my-logos">
    <a href="https://via.placeholder.com/100x80.png">
      <img src="https://via.placeholder.com/100x80.png">
    </a>
  </div>
   <div class="my-logos">
    <a href="https://via.placeholder.com/195x80.png">
      <img src="https://via.placeholder.com/195x80.png">
    </a>
  </div>
   <div class="my-logos">
    <a href="https://via.placeholder.com/175x80.png">
      <img src="https://via.placeholder.com/175x80.png">
    </a>
  </div>
</div>

Any assistance would be greatly appreciated.

Answer №1

Here's an alternative suggestion for you to consider:

.my-logo-container{
  width: 100%;
  margin:0;
}

ul.my-logos{
    margin: 0;
    padding: 0;
    list-style: none;
}

ul.my-logos li{
    width: 32.33333%;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin:0;
    float: left;
    text-align: center;
    border:1px solid red;
}
ul.my-logos li a img{
    max-width: 130px;
    height:80px;
}
<div class="my-logo-container">
  <ul class="my-logos">
    <li>
      <a href="https://via.placeholder.com/100x80.png">
      <img src="https://via.placeholder.com/100x80.png">
      </a>
    </li>
    <li>
      <a href="https://via.placeholder.com/195x80.png">
      <img src="https://via.placeholder.com/195x80.png">
      </a>
    </li>
    <li>
      <a href="https://via.placeholder.com/175x80.png">
      <img src="https://via.placeholder.com/175x80.png">
      </a>
    </li>
  </ul>
</div>

Answer №2

I found a creative solution to my layout issue by adjusting the images themselves instead of setting a minimum space in the CSS. By allowing the images to touch each other, I achieved a visually pleasing display. Using display: flex; and justify-content: space-between;, I arranged the images in a row. Additionally, with max-width: 100%; and height: auto;, the images now automatically resize on smaller screens. This approach has worked well for me.

.logo-container {
  display: flex;
  justify-content: space-between;
}
.logo {
  max-width: 100%;
  height: auto;
}
<div class="logo-container">
<img class="logo" src="https://via.placeholder.com/100x80.png">
<img class="logo" src="https://via.placeholder.com/195x80.png">
<img class="logo" src="https://via.placeholder.com/175x80.png">
</div>

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

The ineffectiveness of setting width to 0

When I set @media screen and (max-width: 700px), aside {width: 0}, it doesn't disappear. Even after resizing the window, it remains as null space with width: 52px. What could be causing this issue and how can I resolve it? * { margin:0; padding ...

Choose the nth item from a group of elements that do not have the same parent node in common

Is it possible to select a specific li element within a dynamic HTML structure without knowing the exact number of ul elements or li elements in each? From my understanding, neither :nth-child nor :nth-of-type can achieve this due to the elements needing ...

Incorporating AJAX functionality into anchor interactions while preserving href links for search engine optimization benefits

Is it possible to create a link/button that triggers an AJAX/jQuery function to load new content, while still providing a link to the same content on a separate page? I am particularly concerned about SEO and how search engine crawlers will index my sitem ...

Navigate to the top of each element, unfortunately, the scrolling feature is malfunctioning

jQuery(".event_item .event_title").each(function(){ jQuery(this).click(function(){ var checkElement = $(this).next(); if(checkElement.is(':visible')) { checkElement.parent().find(".event_content").slideDown().slideUp('norm ...

Is there a way to have the inline form appear on the same line as the buttons?

Currently, I am working on developing an app using Bootstrap 4. In my layout, I have 3 buttons and an inline form. However, the form is displaying below the buttons instead of being in the same line. Can anyone provide guidance on how I can ensure that a ...

What is the best way to ensure that the drop shadow on the bootstrap carousel is not confined by the parent element?

I'm currently using bootstrap's carousel to display items, and I've noticed that the box-shadow attribute on my item blocks is being limited by the parent element that wraps it. https://i.sstatic.net/ks5lC.png Is there a way for me to ensu ...

What is the best way to send put and delete requests through a form using node.js and express.js?

Attempting to send a put request: Put form code snippet: <form id="for" action="/people" method="post"> <div class=""> <input type="text" name="Name" value=<%= data[0].name %> > </div> ...

Unable to create a clickable image

My approach involves using asp:Hyperlink controls to create an image that acts as a link. Here is the sample code in both aspx and C#: <asp:HyperLink ID="mainInteractiveFileLink" runat="server"> </asp:HyperLink> C# mainInteractiveFileLink ...

What are the steps to increase the size of the search bar?

I have been working on this code, but I am struggling to align the search bar properly within the navigation bar. Can someone please guide me on how to achieve this? I apologize for my lack of coding expertise, as I am new to Information Technology and s ...

Place each label and input element on a separate line without using div tags

Can we separate form elements onto individual lines without enclosing them within divs? For example: <label for="one">One:</label> <input type="text" id="one"> <label for="two">Two:</label> <select id="two"> ...

Incorporate a section of HTML code into the 'templateUrl' of

Is it possible to specify only a portion of a file as the templateUrl for your Angular directive? For instance, if I have a file containing: <input type="text" data-name="first-name" /> <input type="text" data-name="last-name" /> <input t ...

What is the best way to increase margin beyond mt-5 or mb-5 in Bootstrap 4?

I am working on a form and would like to set its margin-top to 100px. Is it possible to achieve this using Bootstrap classes, or do I need to create a custom class for it? <form class="mt-5"> </form> It seems that the maximum margin-top I ca ...

There is no CSS styling present

I have a webpage where I want to display a modal overlay when a user clicks on an image or link. Initially, the modal is hidden and empty using this HTML: <!--// MODAL: ITEM PROFILE //--> <div id="profile" class="modal" style="visibility: hidden" ...

What could be causing my HTML button to malfunction, sir?

I'm new to HTML and CSS, and I've created an HTML code for on/off buttons. However, my buttons are not functioning as expected. I've tried troubleshooting but haven't been able to pinpoint the issue. Here is my HTML snippet: .s { p ...

Establish the directory for javascript and css files following the designated URL rewriting regulations in the .htaccess file

Currently in the process of rewriting my URLs by configuring rules in the .htaccess file. The current version of my .htaccess file looks like this: Options +FollowSymlinks RewriteEngine on AddType text/css .css RewriteRule ^lunettes-collection/([ ...

I am experiencing issues with displaying the submenu using CSS and jQuery

I'm experiencing an issue with some code and I seem to be stuck. Could really use some assistance. The submenu is not functioning as expected - when I click the toggle button, the main menu appears but the submenu does not work. I've tried variou ...

Send information from a web page's elements to PHP with the help of AJAX

My goal is to integrate AJAX, HTML, and PHP to create a seamless user experience. I am currently facing difficulty in passing variables to the PHP form. The method I've employed seems a bit complex, especially since this is my first attempt at using A ...

How to add an hr tag to a div element in HTML dynamically with JavaScript?

Whenever a user interacts with the search box, I have a list that gets populated. Here is an example of the overall structure: <div id="searchResult"> <div> <a href="#">result1</a> </div> <div> <a href="#">result2 ...

Steps to get the vehicle approaching the creature

Recently, I ventured into the realm of game development and created a car game where the vehicle moves automatically. However, when the car collides with a monster, I want it to start moving towards the monster instead. After some research, I decided to in ...

Creating space between elements in CSS div elements

I've come across numerous resources on this topic that have already been answered, but none of them have provided a satisfactory solution. Here's the scenario: I have created a basic fiddle showcasing the desired behavior: @ See fidlle If I h ...