What is the best way to align a box once another one has been placed?

I have integrated both Bootstrap and Masonry plugins into my website design. The issue I am facing is that the Masonry plugin box goes under the top Bootstrap bar. I tried adding a margin-top: 50, but this resulted in a horizontal scroll bar appearing.

To see the code and demo, visit: JSFiddle

* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
/* inherit height from window */
html, body {
    height: 100%;
}
body {
    font-family: sans-serif;
}
/* ---- isotope ---- */
.isotope {
    background: #DDD;
    height: 100%;
    /* inherit height from body */
}
/* clear fix */
.isotope:after {
    content:'';
    display: block;
    clear: both;
}

In the demo, you can see that the first box contains an image, causing the middle box to be placed below the top bar. To ensure proper functioning of the Masonry plugin, the middle div should have a height of 100%. How can I prevent the overlapping of the top and bottom divs with the middle div?

Thank you for your help!

Answer №1

Feel free to experiment with the class properties I have modified. Make changes and observe the effects.

.isotope {
    z-index:9999;
    background: #F0F0F0;
    height: 90%;
    /* inherit height from parent element */
    top: 50px;
}

.item.height2 {
    height: 275px;
}

Check out the interactive demo on JSFiddle HERE.

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

The NGRX state in Angular is not being properly saved by the local storage

Currently, I am utilizing NGRX for state management within my Angular application. While NGRX is functioning correctly, I have encountered an issue with using local storage to persist the NGRX state. Upon refreshing the browser, the NGRX data reverts back ...

Do not apply styling to a particular page in CSS and HTML

Utilize the teachable.com platform and take advantage of their code Snippets feature (refer to attached photo #1) https://i.stack.imgur.com/dW1lB.png I inserted the following code: div { direction: rtl; } To modify the website's direction to be ...

Tips on enlarging the header size in ion-action-sheet within the VueJS framework of Ionic

Recently I started using Vue along with the ionic framework. This is a snippet of code from my application: <ion-action-sheet :is-open="isActionSheetOpen" header="Choose Payment" mode="ios" :buttons="buttons&qu ...

Having trouble rendering components due to conflicts between React Router and Semantic UI React

Below is the code in my App.js: import { useRecoilValue } from 'recoil'; import { authState } from './atoms/authAtom'; import { ToastContainer } from 'react-toastify'; import { ProtectedRoute } from './layout/ProtectedRou ...

The functionality of jQuery on hover is not compatible with Bootstrap tree view

My issue arises when the jQuery onhover function does not trigger the anonymous function as expected. Here is my current HTML structure: $(document).ready(function () { $.ajax({ url: "fetch.php", method: "POST", ...

What causes the parameter to be null when jQuery AJAX sends Content-Type=application/json to an MVC Controller Action method?

Apologies for asking a question that has been addressed multiple times before, but I am unsure if the answers from those discussions are still relevant with the latest versions of ASP.NET Core MVC and jQuery. My MVC controller method accepts a class objec ...

What could be causing the malfunction of this Bootstrap button dropdown?

Initially, I attempted using regular HTML for the dropdown button but encountered issues. As a result, I switched to jsfiddle to troubleshoot. Despite my efforts, the dropdown feature still refused to work. If you'd like to take a closer look, here&a ...

In Vue.js, modifying a parent component variable using $parent does not update the interpolation syntax

Child component <template> <div> <h3>Child Component</h3> <div> <button @click="changeValue()">Update Parent Value</button> </div> </div> </template> <script> export ...

Different ways to dynamically change tailwind colors during execution

Utilizing tailwind v3, it's feasible to customize existing colors by modifying the tailwind.config file. https://tailwindcss.com/docs/customizing-colors module.exports = { theme: { extend: { colors: { gray: { ...

Replace Font Awesome icon with a background image

Looking to replace a Font Awesome icon with a background image using only CSS. Current Setup: .btn.btn-default.bootstrap-touchspin-up:before { font-family: Fontawesome; content: "\f067"; font-size: 14px; } Desired Outcome: .btn.btn-de ...

When making an AJAX request to an ASP.NET web method, strange characters are appended to the end of the response text. This issue seems

I need assistance with the following code: $.ajax({ type: 'POST', contentType: 'application/json; charset=utf-8', url: location, data: JSON.stringify(ajaxData), dataType: 'xml', success: ca ...

When a mobile device is rotated, the screen on a jQuery application will automatically shrink

Having trouble with JQM and device rotation on iOS devices. The screen doesn't resize properly when rotated. I have this line in the header to handle display size: <meta name="viewport" content="height=device-height,width=device-width,initial-scal ...

Storing information within a global variable array or exploring alternative methods

I am currently working on a project in electron / node.js and need assistance with the following tasks: Importing data from excel/csv files Visualizing the data using d3.js Cleaning the data by removing duplicates, etc. Using the data for calcu ...

Items seem to vanish into thin air and become immovable when attempting to relocate them

I am attempting to create a unique grid layout with 3x3 dimensions, where each grid item represents a fragment of a single image. These items should have the capability to be dragged and dropped inside another 3x3 grid, in any desired sequence. I have hit ...

What is the process for choosing an element that is embedded within another element?

I'm attempting to apply a red border class to an image located inside another div, using data attribute. I've completed the first part of this task, here's my code: HTML: <div class="delivery-method col-lg-5"> <div class="letter r ...

What is the best way to send the entire image to an API route in Next.js so that I can save it using FS and then upload it to Cloudinary?

I have a form here that utilizes React Hook Form. I'm wondering what I need to pass to the API endpoint via fetch in order to write an image to disk using fs, retrieve its location, and then send that location to Cloudinary. In the body of the fetch ...

The issue with Multiselect arises when the array is being set up initially

Using primeng Multiselect, I have implemented a logic to push data based on search value from the backend. To avoid the error of pushing undefined elements, initialization is required before pushing. However, when I initialize the dropdown's array var ...

Transmitting information in segments using Node.js

Recently delving into the realm of nodejs, I find myself tackling a backend project for an Angular 4 application. The main challenge lies in the backend's sluggishness in generating the complete data for responses. My goal is to send out data graduall ...

The height of each list item should expand based on the size of the div contained within it

The HTML markup I am working with looks like this: <ul data-role="listview" data-inset="true" class="stuff site-content lists"> <li> <div class="nearby"> 20 </div> <h1> name</h1> </li> ...