Creating two adjacent squares can be achieved by arranging columns and rows in a specific way

Looking to create a website with a gallery block but running into some issues. I only want to utilize Bootstrap along with my custom CSS for the finishing touches. The layout should consist of 2 squares next to each other, with the left square being 2 columns and 2 rows, and the right square taking up the same space as the left one. Similar to the image provided.

I've attempted various methods including flexbox, but haven't been able to achieve the desired result.

Here's a screenshot depicting what I'm aiming for

Answer №1

Check out this sample:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link
      href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7c2e23233b3c3b3d2e0fb6dcdcacdbeee480cdc0dccecc9c">[email protected]</a>/dist/css/bootstrap.min.css"
      rel="stylesheet"
    />
    <link
      href="https://getbootstrap.com/docs/5.3/assets/css/docs.css"
      rel="stylesheet"
    />
    <title>Bootstrap Demo</title>
    <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="93c1cccce4c3cec8cbdacdbbcfaaf2ffedf4f4e5e7a8c9dfdadeceeccf86">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>
  </head>
  <body class="p-3 m-0 border-0 bd-example bd-example-row">
    <!-- Sample Code -->

    <div class="container text-center">
      <div class="row">
        <div class="col">
          <div class="col">Cell A</div>
          <br />
          <div class="col">Cell B</div>
        </div>

        <div class="col">
          <div class="col">Cell C</div>
          <br />
          <div class="col">Cell D</div>
        </div>
        <div class="col"></div>
      </div>
    </div>

    <!-- End Sample Code -->
  </body>
</html>

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

Align both the image and text in the center with no space between

How can I center two blocks containing both images and text vertically and horizontally while using flexbox? I notice that when the text is longer, padding appears between the image and the text. How can I remove this padding?1 .product-teaser { width ...

excess margin running along the left side of each page

When visiting http://tadris3.ir/, one may notice a peculiar space on the left side of all pages. Can anyone assist in resolving this bothersome issue? https://i.sstatic.net/MsX1a.png ...

How can I show only the final four digits of an input field using Angular Material and AngularJS?

As a newcomer to Angular Material and Angular JS, I am striving to create an md-input field that displays only the last 4 digits in a masked format, such as "********1234". While my experience is currently limited to using md-input password fields where ...

Ways to determine the height of a responsive div's background image

I have a container with a background image. Inside this container, there are additional elements like my navigation bar. My goal is to make the container have the same height as the background image. I've attempted the following: .bg { ...

`Apply a distinctive color to certain text within the selected text option`

                Does anyone have suggestions on how to create a color highlight with the word "stock" (see image for reference) using CSS, JavaScript, jQuery, or any other language? ...

What is the best way to design a div that showcases text on top of a background image, complete with a pointer or arrow, and automatically adjusts its width to properly display the

Is it possible to create a div with an :after selector, containing text that automatically adjusts its width to fit the content? Seems like a complex task, right? It sure can be. I initially tried achieving this using a div id and :after selector, but ra ...

What is the best way to create a straightforward menu for my HTML game?

I have been working on a basic HTML game and it seems to be functioning more or less. I'm wondering if it's possible to create a simple menu with an image in the background and a "click to start" button within the same file. Any suggestions or ti ...

Keep the text centered, even if it's larger than the container

I'm currently struggling to center some text. Here is how my text is currently formatted: <div class="panel panel-default" ng-repeat="criteria in controller.productCriteria"> <div class="panel-heading"> <div class="row flex ...

What is the best way to ensure that multiple bootstrap buttons in a row have the same width?

Could you help me figure out how to make the <div id="full"> element take up the full width of its parent container, while also ensuring that the 3 buttons inside share this width and have equal sizes with gaps between them? https://i.stac ...

Pressing the reset button will initiate once the loader has finished

Hello everyone, I'm currently working on creating a button that transforms into a loader when submitted and then reverts back to a button after the form is successfully submitted. I suspect the issue lies within my JavaScript. I'm not sure how ...

When trying to upload a file with ng-upload in Angular, the error 'TypeError: Cannot read properties of undefined (reading 'memes')' is encountered

Struggling with an issue for quite some time now. Attempting to upload an image using ng-upload in angular, successfully saving the file in the database, but encountering a 'Cannot read properties of undefined' error once the upload queue is comp ...

Using CSS to Create a Background with RGBA Color and Image

Having an issue with my CSS. I'm trying to create a scrolling background for the left section of my website. The RGBA is currently overlapping the entire page, but I only want it to overlap the background image. The same goes for the gridtile (the ov ...

Conceal HTML components on certain devices

I am interested in customizing the display of HTML elements on different devices to enhance the overall design for specific viewing experiences. For example, I want to optimize the layout when accessing the page on an iPad as opposed to a PC. In order to ...

Ensure that each row contains no more than 5 items, and use flexbox to automatically resize

I currently have the following setup: .container { background: gray; width: 600px; display: flex; flex-flow: row wrap; position: relative; } .item { background: blue; width: auto; height: auto; margin: 4px; flex: 1; flex-basis: 20% ...

At times, the CSS fails to load at first and does not refresh correctly when using F5 or CTRL F5, yet it occasionally loads when clicking on links

After dedicating a full day to trying to solve this issue, I am reaching out for some assistance. As a newcomer here, I apologize if this question has been asked before (I did search extensively and found nothing). The website I'm constructing for my ...

Tips for fixed positioning of a div on a webpage without being affected by the Windows logo shortcut keys + Left/Right arrow

Whenever I utilize the keyboard shortcuts to move a window from one side of the screen to another and then minimize it either upwards or downwards, I find myself faced with an issue. I can accomplish this action by using the Windows key in combination with ...

Issue with the table not being displayed when any of the submitted fields are left empty

After submitting the first field, I receive the second value, and after submitting the second field, I get the third value. I have a group of three fields that are interconnected. <?php $courtname=''; if(!empty($_POST['court_ ...

How do I get rid of the navigation bar on my website?

After implementing Azure login in ASP.NET Core, I noticed that when logging out of the project, it redirects to the sign-in page where a navbar is displayed. How can I remove this navbar? <div class='page-topbar @ViewData["pagetopbar_class&quo ...

Guide to implementing an ES6 template within an HTML anchor tag href

Hello there, this is my first time seeking assistance here. I have an ajax request returning a JSON response. Now, I am aiming to use the response data to dynamically generate recipe titles and also create clickable links with that data. $( window ).load( ...

Setting a variable equal to user input

When using a jQuery script, the elements for the details are dynamically created inside a jQuery function. However, there seems to be an issue with assigning the value from the variable "startLocation" to the input "detail_startLocation[]". Only the firs ...