Position the division block on the page

Is it possible to have 3 div blocks arranged in a specific order? How can I position div 3 below div 1 without changing the layout, as div 3 is responsible for form submission?

.div1 {
  width: 100px;
  height: 100px;
  border: 1px solid;
}

.div2 {
  width: 100px;
  height: 500px;
  border: 1px solid;
}

.div3 {
  width: 100px;
  height: 100px;
  border: 1px solid;
}
<div style="display:flex;">
  <div class="div1">
    div1
  </div>
  <div class="div2">
    div2
  </div>
</div>
<div style="display:flex;">
  <div class="div3">
    div3
  </div>
</div>

Answer №1

If you're looking to tackle this challenge, the best tool for the job is CSS Grid. Take a peek at this amazing demo.

.container {
  display: grid;
  grid-template-rows: repeat(2, 100px);
  grid-template-columns: 100px 500px;
}

.container > div {
  border: 1px solid;
}

.div2 {
  height: 500px;
  width: 100px;
}
<div class="container">
  <div class="box1">
    box1
  </div>
  <div class="box2">
    box2
  </div>
  <div class="box3">
    box3
  </div>  
</div>

Answer №2

Integrate the content of div1 and div3 into a single <div></div> in this manner:

<div style="display:flex;">
  <div>
    <div class="div1">
      div1
    </div>
    <div class="div3">
      div3
    </div>
  </div>
  <div class="div2">
    div2
  </div>
</div>

Answer №3

Hey there Game Eagle,

Have you considered exploring CSS-grid? It's a great way to rearrange content on your website.

In particular, grid-template-areas allows you to designate specific areas for your content and then assign them accordingly.

If you're looking for a useful resource, check out: https://css-tricks.com/snippets/css/complete-guide-grid/

I hope this information proves helpful to you!

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

Error encountered during Bootstrap 4 SCSS compilation: Invalid US-ASCII character identified as "xE2"

Encountering difficulties when compiling certain bootstrap 4 modules (switching from beta3). Despite the fact that the issue can be resolved by adding @charset: 'UTF-8'; to the _hover.scss mixin partial (which is flagged as deprecated within the ...

Troubleshooting problem with displaying HTML content on Internet Explorer 10

My website was developed using jquery with a dynamic coding style. It was functioning properly in IE10 while working from Visual Studio. However, after deploying it to the production server, the entire style seemed broken in IE10. In all other versions o ...

What is the reason behind getComputedStyle having visibility set to visible?

What is the reason behind getComputedStyle always returning element visibility as visible even when no explicit visibility has been set? For instance: getComputedStyle($('#block1')[0],null).visibility; --- "visible" Meanwhile: $('#block1&a ...

Styling Options for Material-UI Tables: Enhancing the Look of Your Table Components

I am working with 'material-ui' and attempting to change the color of a table element based on its value. In the code snippet below, I have tried to make the background color go red if the cell value is "Out of Zone". However, even though the tab ...

Using justify-content-between in a div container with only two items will not produce the desired effect

I'm having trouble aligning two elements on opposite ends of a div container using Bootstrap's justify-content-between class. The h4 element is not on the left and the button on the right as expected. I am using Bootstrap 5.2.3. Can anyone help m ...

Enabling visibility of overflowing text in dynamically inserted divs without using scroll bars

Is there a way to set the text overflow to visible without scroll bars in dynamically added <div>s? Despite what the documentation says, it doesn't seem to be the default behavior and I'm struggling to understand why. Adding text directly t ...

Develop an exclusive "click-once" button for a webpage

Can anyone assist me in creating a "one-time clickable" button to launch my website? I've searched through numerous threads on Stack Overflow but haven't found a solution yet. ...

Issue with Laravel Blade: HTML elements are not being displayed in my blade template file

After implementing WYSIWYG fields in my form, I noticed that the html tags are not being properly rendered upon retrieving the data. The HTML tags still appear in their raw form within the form itself. Attempting solutions found on this thread, I believed ...

Tips on saving this information in a MySQL database

I'm currently developing a php script that collects and saves links in mysql. However, I've encountered an issue where the script sometimes captures multiple links for the same download, as shown below: http://www.fileserve.com/file/XXXXXX http: ...

The issue with the ng-click property not triggering arises when it is assigned to a button that is generated dynamically

I need to construct a table dynamically based on the results returned from SQL. In this scenario, populating the table with the start time, end time, and user is straightforward: var StartTime = document.createElement('td'); var EndTime = docume ...

Having trouble with the JavaScript function not working on page load

I'm currently working on writing JavaScript code that will run once the child page, created using the window.open function, has fully loaded. Despite trying methods like window.onload and window.setTimeout, I haven't had any success. I even expe ...

Creating a child div that is half the size of its parent

Is there a way for a child div to inherit half the width and half the height of its parent div without using specific values or viewport units? ...

Unable to interact with web element

When using selenium, I have a web element that I want to select. The WebElement.IsDisplayed() method returns true, but I am unable to perform the webelement.click() operation. port_dimension = canvas.find( By.xpath( "//*[local-name() = 'rect'][ ...

Modifying HTML tag attributes with inline server scripts

I am working with a submit button and trying to change the background color of the button itself after it has been clicked using inline server tags. <form id="form1" runat="server"> <input type="submit" id="submit" value="Submit" runat="server"/& ...

js - displaying function results in an HTML table

I have developed a tool that can display the repayment schedule over the loan term. I have successfully calculated the monthly payment, interest, and remaining loan amount, but I am facing difficulty in presenting this data in a table format. I aim to hav ...

Include images in the form of .png files within the td elements of a table that is dynamically generated in the index

I have successfully created a table using embedded JavaScript with the help of messerbill. Here is the code: <table id="Table1"> <tr> <th>Kickoff</th> <th>Status</th> <th>Country</th> < ...

Pressing the enter key will submit the form

After receiving feedback from users in my live chat room, one common request was to add a feature that allows them to send a message by pressing the enter button, instead of creating a new line in the text box. Despite attempting to implement some jQuery ...

Email button designed to trigger the execution of PHP code

Can a hyperlink button in Outlook emails be used to run PHP code? For instance, I've designed a computer request form that appears as follows: New Request When you select the "new request" button, it changes to indicate completion: Completed Reque ...

Unable to move the content inside a fixed container by scrolling

Having difficulties with a menu layout where the parent container spans across the entire site and a div contains the actual content. Everything looks fine on larger screens, but on mobile devices, it's challenging to display all the content. I' ...

Does the language setting on a browser always stay consistent?

Using javascript, I am able to identify the language of my browser function detectLanguage(){ return navigator.language || navigator.userLanguage; } This code snippet returns 'en-EN' as the language. I'm curious if this i ...