Creating tilted divs with dynamic height to perfectly fit the content

I'm struggling to incorporate this design into my webpage; I can't seem to get the right div's height to match the left div as depicted in the second image. Can someone offer some assistance?

Additionally, when viewed on mobile, the squares are being displayed one per line, but I need them to display two per line.

Below is the code:

<div class="container-fluid caffstudio">
  <div class="row">
    <div class="col-md-6 caffLeft">
      <div class="row">
        <!-- caff logo -->
        <div class="col-md-4">
          <div class="cfimgdiv" style="display: inline-block">
            <img src="caffeine logomark.svg" class="imgcaff" />
          </div>
        </div>

        <!-- caff text -->
        <div class="col-md-8" style="display: inline-block">
          <div class="cafftext">Caffine UX Design Studio</div>
          <div class="cafftext1">
            Lorem ipsum dolor sit amet consectetur. Quisque velit cursus nulla aenean aliquam auctor orci.
          </div>
          <br />
          <a href="#" class="linkcaff mt-10">Visit Website</a>
        </div>

        <!-- first line of cards -->
        <div class="container-fluid">
          <div class="img4">
            <div class="row">
              <div class="col-md-6 col-sm-12 im4div">
                <div class="im4" style="display: inline-block">
                  <img src="experience.svg" />
                </div>
                <div class="im4txt" style="display: inline-block">
                  <div>5 yrs</div>
                  <div>Experience</div>
                </div>
              </div>
              <div class="col-md-6 col-sm-12 im4div">
                <div class="im4" style="display: inline-block">
                  <img src="projects.svg" />
                </div>
                <div class="im4txt" style="display: inline-block">
                  <div>25+</div>
                  <div>Projects completed</div>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-md-6 col-sm-12 im4div">
                <div class="im4" style="display: inline-block">
                  <img src="pipeline.svg" />
                </div>
                <div class="im4txt" style="display: inline-block">
                  <div>10+</div>
                  <div>Project in pipeline</div>
                </div>
              </div>
              <div class="col-md-6 col-sm-12 im4div">
                <div class="im4" style="display: inline-block">
                  <img src="screensdelivered.svg" />
                </div>
                <div class="im4txt" style="display: inline-block">
                  <div>1597</div>
                  <div>Screens delivered</div>
                </div>
              </div>
            </div>
          </div>
        </div>  
      </div>
    </div>
    <div class="col-md-6 col-sm-12" style="z-index: 1;">
      <div class="multipleRect">
        <div class="twoRect">
          <div class="greyRect"></div>
          <div class="greyRect"></div>
        </div>
        <div class="twoRect">
          <div class="greyRect"></div>
          <div class="greyRect"></div>
        </div>
        <div class="twoRect">
          <div class="greyRect"></div>
          <div class="greyRect"></div>
        </div>
      </div>
    </div>
  </div>
</div>

CSS

.caffstudio{
  margin: 0 auto;
  background-color: #211E1E;
  position: relative;
  padding-left: 30px;
  overflow: hidden;
}

.greyRect{
  width: 200px;
  height: 200px;
  background: #D9D9D9;
  border-radius: 18.6457px;
  display: inline-block;
  margin: 5px;
}

.multipleRect{
  transform: rotate(12deg);
  max-height: 80%;
}

My current output: [1]: https://i.sstatic.net/6hUSm.png

Expected output: [2]: https://i.sstatic.net/HN793.png

Answer №1

For optimal display on mobile devices, I recommend exploring the use of flexbox and media queries to customize the arrangement of your boxes.

Here's a simple example:

@media (max-width: 767px) {
  .twoRect { 
    display: flex; 
    flex-wrap: wrap;
    justify-content: space-between;
   }
}

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

Emphasize hyperlink according to the current page (Dynamic Navigation using PHP)

While some may find this task simple, I have been struggling to make it work despite trying various methods. Let me give you a brief overview; I have a single page with links that, when clicked, load other pages but display them within the same page. ...

Issue with getting Bootstrap sticky-top to function on sidebar column

My goal is to implement a sticky sidebar on the right side of the page. The sidebar menu is contained within a grid column. I have attempted to utilize the sticky-top class, following the guidance provided in this question, but unfortunately, it does not s ...

Form aligned to the right

Is there a way to align the form to the right in this code? HTML @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@500&display=swap'); * { font-family: "Noto Sans", sans-serif; font-weight: 500; } .no-outline { ...

Is it better to set a timeout for executing a script in a view, or to incorporate an efficient timeout directly into the

After putting in some effort, I have managed to partially achieve my desired outcome. However, I am still exploring options to improve it further. Here is the situation: There is a controller that displays a view upon successful password reset. Within thi ...

What are some ways to reduce the delay of Dark mode on a website?

Can anyone help me optimize the speed at which dark mode is applied on my website? Currently, there seems to be a delay between page load and the dark mode taking effect. Below is the jQuery.js code I am using: onload = function () { if (localStorage. ...

Moving DOM Elements around

Objective: Looking to relocate an element within the DOM structure. Condition: Although I am familiar with using jQuery for this task, I am currently working in an environment without access to it. Therefore, I need a pure JavaScript solution. Example: ...

Convert HTML tr elements into a PHP array

After realizing that my previous thread lacked clarity, I decided to delete it and start fresh. In my php script, I send a cURL request to a website which generates an HTML table. This table contains 7 TR elements, each containing 6 TD elements. Essentia ...

Include a scrollbar within a div element nested inside a table cell

index.html <div id="wrapper"> words go here, many of them </div> style.css #wrapper { height: 100%; width: 200px; overflow: auto; } I have been struggling to display the scroll bar on my page, and this is what I am currently exp ...

The functionality of the Bootstrap grid system has proven to be ineffective

Hello, I am currently using Bootstrap 3 and attempting to configure my template. It seems like I may not have a full grasp on the concept of 'row' in Bootstrap because my template is not behaving as expected. Take a look at this full screen fidd ...

using outlines for FontAwesome icons in React Native

I am struggling to use the fontAwesome + icon in the middle of a circle as one item. I have tried placing it inside a circle icon, but it doesn't seem to work properly. import IconFA from 'react-native-vector-icons/FontAwesome'; < ...

Struggling to include additional spacers in my SCSS due to limitations with Bootstraps $spacer variable

I've encountered an issue where I am unable to add new spacers to Bootstrap (4.3) in my SCSS file. Interestingly, my custom style sheet is placed after bootstrap.css in the HTML. In my SCSS file, the sequence appears as follows: $spacer: 1rem !defaul ...

Is it possible to enable an email hyperlink to function on a computer?

I successfully created an email link that is functional on mobile devices by using 'href="mailto:[email protected]"'. When I click on the button from a mobile device, it prompts me to choose how I want the email delivered. However, when I tr ...

Tips for showcasing overflowing text in a menu list by rotating the item text

Imagine you have a TextMenuItem component, using MenuItem from the Material-UI library, that is part of a chain consisting of DropDownSearch > SimpleListMenu > FixedSizeList > TextMenuItem. In simple terms, this creates a searchable dropdown eleme ...

Encountering an error in Selenium Python when using the second iteration of find_elements_by_xpath

I'm currently navigating through my college website dashboard to find all relevant subjects. I am utilizing selenium for this task. Due to the slowness of the site, I implement a waiting period. WebDriverWait(driver, 20).until(EC.element_to_be_clickab ...

The email message content is not displaying correctly

I'm in the process of merging multiple HTML tables into a single $message, which will then be passed to the email body as shown below. // Sending the email if(smtp_mail($To,$cc, $Subject, $message, $headers)) { echo "Email Sent"; } else { echo "An ...

The function you are trying to use is not a valid jQuery function

Although I've come across this issue in previous posts, none of the solutions worked for me and it's really frustrating. I'm a newbie to javascript and I'm sure the answer is probably simple. I'm attempting to incorporate the rapt ...

Displaying an alert on a webpage that shows a label input using JavaScript and

I'm currently working with HTML5 and JavaScript and I'm facing a challenge. I want to create a feature where users can input any word into a label, and when they click on a button, an alert is triggered with the given text. However, despite my ...

Can the minimum length be automatically filled between two elements?

I'm struggling to find a way to adjust the spacing of the "auto filling in" dots to ensure a minimum length. Sometimes, on smaller screens, there are only one or two dots visible between items. Is there a way to set a minimum length for the dots in th ...

Displaying content on a click event in AngularJS

I am facing an issue with the ng-show directive not working as expected when a user clicks on an icon. The desired behavior is that the parent div should initially display content, but when the play icon is clicked, the contents of the div should become ...

The mysterious workings of the parseInt() function

As I begin my journey to self-teach JavaScript using HeadFirst JavaScript, I've encountered a minor obstacle. The chapter I'm currently studying delves into handling data input in forms. The issue arises when I attempt to utilize the updateOrder( ...