What is the best way to synchronize the heights of two div containers when zooming in the browser causes one container to expand, ensuring they both remain aligned at the bottom

Greetings! I am currently working on designing a webpage that consists of two parts: a left section with buttons and a right section with a table view. Everything looks perfect until I zoom in my browser to 150% or more, causing the content in the table to expand vertically. This results in the bottom of the two sections not aligning horizontally.

My main concern is how to ensure that the bottom of both sections always stay in the same line, even when zooming in. While some may suggest filling the background with white to hide this issue, I require keeping the border lines intact and aligned properly.

Below is a snippet of my current code which includes both HTML and CSS:

HTML File:

<div class="container-fluid vuln-content">
  <div class="row">
    <div class="col-2 filter-container">
      <div id="filter-card">
        <app-vuln-filter [currentSelectedTabIndex]="currentSelectedTabIndex"></app-vuln-filter>
      </div>
    </div>
    <div class="col-10">
          <p-tabView (onChange)="onClick($event)" styleClass="vuln-tabs">
            <p-tabPanel *ngFor="let gridConfig of gridTabConfigs" id={{gridConfig.id}} header={{gridConfig.header}}>
              <app-vul-ami-grid [gridConfig]="gridConfig"></app-vul-ami-grid>
            </p-tabPanel>
          </p-tabView>

    </div>
  </div>
</div>

The CSS styling for the webpage is as follows:

.vuln-content {
  min-height: calc(100vh - 37px);

  .filter-container {
    margin: 10px 0 0;
    background: #FFFFFF;
  }

  & > div.row {
    margin: 0 0 0 -10px;
  }
}

If you believe resolving this issue requires JavaScript, particularly within an Angular framework, I am open to exploring and learning new techniques. Your guidance on achieving a consistent alignment between the two sections would be greatly appreciated. Thank you!

Answer №1

It appears that you are utilizing Bootstrap. One option to consider is implementing flexbox, which will help to vertically stretch your rows equally. For more information, you can refer to the following link: https://getbootstrap.com/docs/4.4/utilities/flex/#align-items

<div class="d-flex align-items-stretch">...</div>

Answer №2

Perhaps you can experiment with this solution...

HTML

<div id="container">
<div id="item">Your content here</div>
</div>

CSS

#container {display: table}

#item {
display: table-cell;
vertical-align: left;
}

The key point to remember is to align the button panel to the left vertically...

Answer №3

Just like @V.Volkov mentioned, Bootstrap is being utilized in your code. However, I would suggest a more precise approach. I have included the align-items-stretch class within the

<div class="row">
, as the .row class already has display: flex in Bootstrap CSS. This modification should function correctly:

<div class="container-fluid vuln-content">
  <div class="row align-items-stretch">
    <div class="col-2 filter-container">
      <div id="filter-card">
        <app-vuln-filter [currentSelectedTabIndex]="currentSelectedTabIndex"></app-vuln-filter>
      </div>
    </div>
    <div class="col-10">
          <p-tabView (onChange)="onClick($event)" styleClass="vuln-tabs">
            <p-tabPanel *ngFor="let gridConfig of gridTabConfigs" id={{gridConfig.id}} header={{gridConfig.header}}>
              <app-vul-ami-grid [gridConfig]="gridConfig"></app-vul-ami-grid>
            </p-tabPanel>
          </p-tabView>

    </div>
  </div>
</div>

Alternatively, you can manually set align-items: stretch; in your CSS.

.vuln-content {
  min-height: calc(100vh - 37px);
  //height: calc(100vh - 35px);

  .filter-container {
    margin: 10px 0 0;
    background: #FFFFFF;
  }

  & > div.row {
    margin: 0 0 0 -10px;
    align-items: stretch;
  }
}

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

Encountering the issue of "unexpected error: autocomplete is not defined" when trying to retrieve information

I am using jQuery for retrieving remote data but encountering an error Uncaught TypeError: $(...).autocomplete is not a function. I have made several attempts, yet I cannot identify the root cause of this issue. It seems like there might be an error in ...

Increasing the size of a background image as you scroll

Is there a way to adjust the background image of a div so that it scales according to the amount the page is scrolled? The current implementation works fine on desktop screens, but on mobile screens, the height of the background image reduces and the image ...

React - Struggling to modify state with setState within an onClick event

Having trouble updating the state with setState inside an onClick event on a button. I've added a console.log inside the function and it works, but the setState doesn't update the state. I've attempted two different approaches: <button o ...

Issue observed with alignment not being corrected when the browser is resized on a responsive webpage

Utilizing Bootstrap3 for my responsive page design. In the banner content, I am including a box with text inside: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> <s ...

Error code (6) occurred during the upload process on the Google Drive website, resulting in

I'm currently working on building a website that allows users to upload files directly to Google Drive from the website itself, but I've encountered numerous challenges in the process. Here's the code snippet I've been using: <!DOCT ...

"Enhance your website with Express.js and eliminate the need for full

As I continue to work on my website, I am faced with a challenge. While the page is not overly large, I want to ensure that when navigating to different tabs in the navbar, the entire site does not have to reload each time. Currently, I am using express.js ...

Javascript loop malfunctioning

Within my project using kinetic.js for HTML5 canvas, I have an array filled with code that needs to be executed. To accomplish this, I utilize a for loop to iterate through the array and employ eval() to run the code. This array is named tiles, which cont ...

Prevent double tap selection

At times, I enable the user to click on the <li> or <span class="icon"> elements, but if they happen to click twice, it causes a bit of chaos and spreads the blue selection all over :/ To address this issue, I have come up with two solutions: ...

I am looking for a method to provide access to files located outside of the public folder in Laravel

Imagine <link rel="stylesheet" href="{{asset('css/style.css')}}"> is used to retrieve the style.css file from the public folder. How can I access a file that is located in the resources folder in a similar way? ...

Can you explain the purpose of prevState within the setState method of a functional component?

When returning the updated previous state within a setState method retrieved from the useState hook, it appears that the state remains unchanged. To demonstrate this behavior, consider running the following code snippet: function App(){ const [state, ...

Encountered a 404 error while using a MEAN stack application

Encountering a 404 error while attempting to post data using Postman in Chrome. Any assistance will be greatly valued. I am following the application from this link: https://www.youtube.com/watch?v=wtIvu085uU0 Here is the code snippet: //importing modul ...

What is the method for creating a loop that includes a radio-like button?

https://i.stack.imgur.com/YkheU.jpg How can I create a button that functions like a radio button? What is this type of button called? And how can I add radio buttons in a loop similar to the image above? I know the button input needs to be wrapped with ...

The :contains method in jQuery functions smoothly in Firefox, Safari, and Chrome, but unfortunately does not work

My code on JSFiddle is having some compatibility issues with the jQuery :contains selector specifically in Internet Explorer versions 7, 8, and 9. The code works fine in Firefox, Safari, and Chrome. You can find the working code here. I tried making the ...

What is causing the issue with the .change() function not functioning properly?

Recently, I encountered a situation where I had the following HTML code: <span class="offersReceivedCount">3</span> My goal was to trigger some code whenever the value of 3 changed to something else. In order to achieve this, I used Handlebar ...

Limit the jQuery dialogue button to just one click

My goal is to create a jQuery dialogue box that sends data when the 'OK' button is clicked. The challenge I'm facing is making sure it only sends the data once, regardless of how many times the button is clicked. $.dialogue({ ...

Array of generic types in Typescript

Here's a method that I have: getFiveObjectsFromArray(array: T[]) { return array.slice(0, 5); } I've been using this method multiple times. Is there a way in TypeScript to pass a generic argument instead of using multiple types? Also, when ...

The button's background color will vanish if you click anywhere outside the button or on the body of

Struggling with a tabpane created using HTML, CSS, and JavaScript. The problem arises when the background color of the active tab's button disappears upon clicking outside the button or on the body. While switching between tabs, I can change the color ...

Text that is aligned vertically and centered within a div container

I need help figuring out how to make a single line of text run vertically and stay centered within its container, both from left to right and top to bottom. Any suggestions on how to achieve this using CSS? ...

positioning a text input in the center instead of at the top of the page

Hello everyone, I am just starting out with HTML and I have a question. How can I make the Username: <input type="text" name="Username" style="- margin-top: 200px;"> appear in the center of the page instead of at the top? I've tried changing the ...

Executing multiple HTTP requests in parallel with AXIOS and retrieving the responses even if one of the requests fails

I am currently working on optimizing server get requests to run concurrently. To achieve this, I have developed the following function. Issue The problem arises when one request fails, causing me to lose track of the responses from the other requests. e ...