What is the best way to design three boxes in varying sizes?

I am currently facing an issue while trying to create 3 boxes: one big box and two small ones next to it. Each box contains images, but the problem is that the two small boxes are not responsive on any devices except desktop. I have been troubleshooting this for a while now and still can't figure out what I'm doing wrong.

.fashion_look img {
  width: 100%;
  display: inline;
  -webkit-transition: opacity 0.5s, -webkit-transform 0.5s;
  transition: opacity 0.5s, transform 0.5s;
}

.main-container .block-container .fashion_look .content {
  position: absolute;
  top: 5%;
  left: 0%;
  width: 100%;
  text-align: center;
  padding: 0 35px;
}

.main-container .block-container {
  display: inline-block;
  width: 100%;
  float: left;
}

.main-container .widget-static-block {
  display: block;
  overflow: hidden;
  padding-top: 60px;
}

.main-container .block-container .banner_top,
.main-container .block-container .new_shoes,
.main-container .block-container .fashion_look {
  position: relative;
  overflow: hidden;
}

.main-container .block-container .overlay {
  bottom: 0;
  height: auto;
  left: 0;
  margin: 0;
  opacity: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: all 0.2s ease-in-out 0.1s;
  -moz-transition: all 0.2s ease-in-out 0.1s;
  -webkit-transition: all 0.2s ease-in-out 0.1s;
  -o-transition: all 0.2s ease-in-out 0.1s;
  width: auto;
  z-index: 2;
}

.main-container .block-container .new_shoes .content {
  position: absolute;
  top: 10%;
  left: 0%;
  width: 60%;
  text-align: center;
  padding: 0 35px;
}
<div class="widget widget-static-block">
  <div class="block-container">
    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
      <div class="fashion_look">
        <div class="overlay">&nbsp;</div>
        <a href="https://www.acureorganics.com/skin.html"><img src="#></a><br>
        <div class="content">
          <h3>&nbsp;</h3>
        </div>
      </div>
    </div>
    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
      <div class="row">
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
          <div class="new_shoes">
            <div class="overlay">&nbsp;</div>
            <img src="#">
            <div class="content">&nbsp;</div>
          </div>
        </div>
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
          <div class="overlay">&nbsp;</div>
          <div class="banner_top">
            <a href="https://www.acureorganics.com/body.html"><img src="#"></a>
          </div>
          <div class="banner_top">
            <div class="content">&nbsp;</div>
            <div class="content">&nbsp;</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

Answer №1

The challenge lies in the improper scaling of images in the two small boxes, causing them to not fit on the same row when the screen size is reduced.

By applying the following CSS code, the issue can be resolved:

img {
  width: 100%;
  height: auto;
}

You can view the solution in action on this demo.

Answer №2

Creating Layout with Bootstrap 4 Utilities

I wasn't certain about the placement of the side section on mobile devices, so I have positioned it below the main section for clarity. Note that the background colors are solely for visual differentiation.

body, html{
  height:100%;
  }
  
  
  .container-fluid,
  .container-fluid .row{
    height:100%;}
<link href="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="87e5e8e8f3f4f3f5e6f7c7b3a9b6a9b6">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
  <div class="row">
    <div class="col-12 col-md-8 bg-primary text-white">
      <h2>Main Column</h2>
    </div>
    <div class="col-12 col-md-4">
      <div class="row px-md-3">
        <div class="col-12 mb-md-3 bg-dark text-white">
          Top Secret
        </div>
        <div class="col-12 bg-warning">
          Bottom Secret
        </div>
      </div>
    </div>
  </div>
</div>

If you'd like to explore an alternative implementation using additional custom CSS or a grid layout, feel free to provide further instructions.

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

Display/Conceal content with JQuery on a PHP webpage

I am having trouble with the following code. My intention is to show/hide the content between the #info id when clicking buttons, but nothing seems to be happening. Could you help me identify the issue? echo '<script> $( "#show' . $r ...

The latest version of npm Boostrap (4.1.0) is missing some important CSS properties for the `background` tag

I am currently working on an Angular 5.2.10 project that utilizes angular-cli and bootstrap version: 4.0.0-beta.2 with a specific css class called .en-icon-24: .en-icon-24 { background: url(../../../../assets/img/icons.png) -370px 0px; width: 24 ...

The two items are not situated side by side

Trying to make my page responsive, but when I inspect and look into mobile view, the elements do not align next to each other like they do on desktop. https://i.sstatic.net/8WhxD.png I want the shopping cart icon and button to be positioned next to each o ...

Creating a static menu icon and implementing a wide dropdown menu in Bootstrap 4

I am facing two major challenges and I am struggling to find solutions for them! Below is the code snippet I am working with: @font-face { font-family: 'yekani'; src: url("../fonts/yekan.ttf"); } @font-face { font-family: 'ye ...

Update the table contents smoothly using the html helper PagedListPager without having to reload the entire

I am struggling with a specific line of code that utilizes the html helper's PagedListPager: @Html.PagedListPager(Model.kyc_paged_list, page => Url.Action("ClientDetails", new { id = ViewBag.ID, kyc_page = page, transaction_page = Model. ...

Issue with displaying images in Bootstrap carousel

I'm facing a challenge with integrating a bootstrap carousel into a website project I'm customizing for a client. Despite my efforts to add photos and captions, the images are aligning in a list format and the captions are stacking on top of each ...

How can the HTML input fields be adjusted to generate the specific array needed in PHP?

I have created an HTML form with the following structure: <form action="sample_test.php" method="post"> <input type="text" name="fileName" value="8.png" id="fileName[]"> <input type="text" name="fileLink" value="https://www.filepicker.i ...

Creating a smooth transition effect with a 3-second delay in CSS for a single div element or <h1>

Looking to achieve the fadeIn and fadeOut effect on an element or any other div tag with a delay of 3 seconds. Please provide a CSS-based solution without using jQuery. Thank you! ...

Redirect to a randomly selected website from an array of links after a certain period of time

Here is some code snippet that I'm working with: jQuery(document).ready(function() { var textArray = [ 'www.yahoo.com', 'www.wikipedia.org' ]; var randomNumber = Math.floor(Math.random()*textArray.length); link.se ...

Personalized navigation bar using the Bootstrap 5 framework

I am seeking to create a unique custom navbar layout with specific requirements: A centered logo 3 collapsible menu buttons on the left 2 icons (account and Instagram) on the right, always visible When the left menu is collapsed, I want to display a hamb ...

What is the best way to organize the Fields into 4 identical columns within a grid layout?

I need assistance with organizing my UI elements into 4 equal columns, where both the label and input field appear on the same line within a grid or form layout. Can you please advise on the appropriate class to apply to the div tag that contains each pa ...

Properly implement CSS to ensure text responds effectively across different devices

I need some help reducing the size of my commerce titles in the responsive version. I've tried using CSS, but nothing seems to be working. Currently, this is what I have for the main slider text: @media only screen and (max-width: 600px) {.zphero-bann ...

Numerals for Central Leaflet Marker

Is there a way to effectively center numbers inside markers? Here is the current situation: View Marker with Number How to Create a Marker return L.divIcon({ className: "green-icon", iconSize: [25, 41], iconAnchor: [10, 44], popupAn ...

The browser is only showing particular changes made to the CSS file

I'm currently working on a web project and have the following CSS and HTML code: style.css: body { background-color: red; font-size: 14px; font-family: Roboto,arial,sans-serif color: gray; } img { height: 92px; width: 272px; ...

Adjusting canvas context position after resizing

I've been experimenting with using a canvas as a texture in three.js. Since three.js requires textures to have dimensions that are powers of two, I initially set the canvas width and height to [512, 512]. However, I want the final canvas to have non-p ...

Ideal C++ tool for displaying a non-changing HTML page

I am looking to develop a simple cross-platform C++ project for displaying HTML pages, like an application that showcases help materials. These pages may contain images and styles (CSS embedded in HTML). I am researching the best way to incorporate the fol ...

Avoid having the content below become pushed down by a collapsed navbar

I am utilizing Bootstrap 4.1 My current structure is as follows: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhkt ...

Angular 14's "rootItem" animation trigger was created with the following alerts: - The properties listed below are not animatable: overflow

Upon upgrading to Angular 14, I encountered this warning. The properties mentioned are not actually used in my animations. [Error in console][1] The animation triggers "rootItem" has been built with the following warnings: - The following provided propert ...

Preventing CakePHP from inserting comment tags in the output

Currently, I am working on creating an endpoint that will return JSON data. {"a":1,"b":1} Surprisingly, when my code runs, Cake inserts an HTML tag into the output result. {"a":1,"b":1} <!-- 0.0964s --> This unexpected formatting is causing issue ...

The Facebook Javascript SDK is creating unnecessary margin/padding on a responsive Twitter Bootstrap page when viewed in Firefox

I've been struggling to understand why my Bootstrap responsive pages have an additional 25-30px on the right side in Firefox and Internet Explorer when the window width is less than 600px. I decided to systematically remove parts of my code until I wa ...