Eliminating the need for horizontal scrolling in the window causes a change in the height of an internal DIV element

Check out this snippet of code, a simplified version of a larger piece:

html, body {
margin: 0 !important;
padding: 0 !important;
/* overflow-x: hidden; /* uncomment this line */
}
.app {
position: relative;
width: 100%;
text-align: center !important;
}
.left_panel {
top: 250px;
z-index: 20;
}
.panel {
background-color: #aaeaff;
}
.panel_gallery {
width: 256px !important;
}
.panel_gallery .panel_content {
    overflow-y: auto;
}
.middle_right_panel {
position: absolute;
top: -100px;
z-index: 10;
left: 50%;
transform: translate(-50%);
}
.middle_panel {
margin-bottom: 270px;
}
.left_panel, .middle_panel {
display: inline-block;
}
.middle_panel {
transform: scale(0.6);
}
<div class="app" style="display:inline-block;text-align:left;margin-top:10px;">
<div class="left_panel" style="position:relative;">
<div class="panel panel_gallery">
<div class="panel_content clearfix">
abc<br />
def<br />
ghi<br />
</div>
</div>
</div>
<div class="middle_right_panel" style="display:inline-block;">
<div class="middle_panel" style="position:relative;">
<div class="workspace" style="position:relative;display:inline-block;width:400px;height:400px;background-color:#80ff8f;" />
</div>
</div>
</div>

Take a look at the JSFiddle: https://jsfiddle.net/qwt8mfo9/

If you spot one horizontal scroll on low window width as shown below:

https://i.sstatic.net/Wpkcc.png

There's a need to remove it.

Attempting with overflow-x like so:

html, body {
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden;
}

leads to an issue where content height is affected, causing the bottom of the window not to be reached by the div:

https://i.sstatic.net/v3WDc.png

Any insights on fixing this to ensure the div reaches the bottom again after removing the horizontal scroll?

Kindly provide any modifications on a forked JSFiddle.

Many thanks!

Answer №1

Give this code a shot:

.center_right_panel {

position: absolute;
top: -100px;
z-index: 10;
left: 0;
right: 0;

}

Substitute the current CSS for ".center_right_panel" with the code provided above.

Answer №2

To make the resizing work, simply add height:100% and you're done. For a demonstration on how to resize, refer to this jsFiddle https://jsfiddle.net/qwt8mfo9/8/

html, body {
margin: 0 !important;
padding: 0 !important;
overflow-x: hidden;
height: 100%;
}
.app {
position: relative;
width: 100%;
text-align: center !important;

}
.left_panel {
top: 250px;
z-index: 20;
}
.panel {
background-color: #aaeaff;
}
.panel_gallery {
width: 256px !important;
}
.panel_gallery .panel_content {
    overflow-y: auto;
}
.middle_right_panel {
position: absolute;
top: -100px;
z-index: 10;
left: 50%;
transform: translate(-50%);
}
.middle_panel {
margin-bottom: 270px;
}
.left_panel, .middle_panel {
display: inline-block;
}
.middle_panel {
transform: scale(0.6);
}
<div class="app" style="display:inline-block;text-align:left;margin-top:10px;">
<div class="left_panel" style="position:relative;">
<div class="panel panel_gallery">
<div class="panel_content clearfix">
abc<br />
def<br />
ghi<br />
</div>
</div>
</div>
<div class="middle_right_panel" style="display:inline-block;">
<div class="middle_panel" style="position:relative;">
<div class="workspace" style="position:relative;display:inline-block;width:400px;height:400px;background-color:#80ff8f;" />
</div>
</div>
</div>

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

"Implement a smooth scrolling animation on the page to automatically move a div element upward and lock

I am attempting to create a unique animation for a header div that involves moving it to the top of the screen when the user scrolls down. Once the header div reaches the top, I want it to stay fixed in that position. As the header div moves upwards, it wi ...

Refreshing Django HTML table dynamically upon database updates

Currently, I have an HTML table set up using a Django template to showcase data from my database. I am looking to ensure that this table remains updated in real-time whenever the database undergoes changes. Despite my research efforts, there is limited inf ...

The functionality of Ajax autocomplete with jQuery does not function properly when the text field contains existing text

Currently, I am utilizing Ajax autocomplete for jquery in my project. Below is the HTML code snippet I have implemented: <input type="text" name="autocomplete" id="globalBCCAutoComplete"> Furthermore, here is the JS code utilized for the autocomple ...

Looking to utilize the <pre> tag without any external CSS styles defined in a separate stylesheet?

In my current project, I am using bootstreap v3.2. I am facing an issue where I need to display fetched content from the database on a page using the <pre></pre> tags. However, the problem is that the content is being displayed with the default ...

Finding the value of a span tag using a specific CSS class with jQuery

How can I retrieve the value of a span tag based on its css class using jQuery? <span class="page-numbers current">3</span> I attempted to do so with the following code: var pageno = $(".page-numbers current").val(); alert(pageno); Howeve ...

What is the reason behind the `h-full`/`height:100%` not completely filling the void within a div element?

The issue lies in the structure of my content, which includes a title, a subtitle, and a footer. My desire is for the subtitle's div to fill the gap between the title and the footer. I attempted using h-full on the div element, but it had no noticeab ...

Creating multi-level nested lists with numbering using HTML and CSS

Is there a way to create a unique numbering format using only HTML and CSS lists (<ul> or <ol>)? 1. Item A 2. Item B 3. Item C 3.1. Subitem C.1 3.2. Subitem C.2 3.3. Subitem C.3 4. Item D 4.1. Subitem D.1 4.1.1 Sub-subi ...

Drop-down and autocomplete feature in Material UI design framework

Encountering an issue with aligning a label with a dropdown in material UI, and for some reason, this behavior is observed: https://i.sstatic.net/n7pj8.png Struggling to get them aligned on the same row. This is the code snippet of my component: const us ...

Trouble with Divs and Element Placement

I am struggling to recreate this layout example. I attempted to make it align correctly, but I am having trouble looping the comment box under the review score. Can someone provide an example or guide me on how to achieve this design? Example image: http ...

Extracting Text from a Span Element Using XPath in Selenium

Here is the HTML code snippet: <div class="a-row a-spacing-small a-size-small"> <div class="a-row"> <a class="a-link-normal a-declarative g-visible-js reviewStarsPopoverLink" href="#" data-action="a-popover" data-a-popover="{"closeButton":" ...

Troubleshooting text-rendering CSS issues in Netbeans

body, html{ font-family: 'Lato', sans-serif; text-rendering: optimizeLegibility !important; -webkit-font-smoothing: antialiased !important; color: #5a5a5a; } there was a CSS parsing error due to an unrecognized property ...

What is the method to display Post values to the user without necessitating a page reload?

Currently, I am attempting to utilize Ajax to send the user's inputted data from a JSP page. Through Ajax, I have successfully transmitted the variable "vars" to the Jsp page. The output upon registration includes: Registration is Successful. Welcome ...

The CSS3 selector matching a value starting with "[attribute^=value]" does not match a value that has spaces after the quotation marks

When using the div[class^="test"] selector, keep in mind that it will not select an element with a class attribute like class=" test-something" (This selector was generated on the backend.) Using the div[class^=" test"] is not a valid choice. ...

Steps for creating a new tab and refreshing the address bar with a different URL without having to reload the current page

I'm trying to create a functionality on my page where clicking a button will open a new tab with a modified URL, all without reloading the current page. Below is the code that I'm using when the button is clicked: function changeUrl(){ var pri ...

Ensure that any modifications made to an Angular service are reflected across all components that rely on that service

I am currently in the process of replicating a platform known as Kualitee.com, which serves as a test-management tool utilized by QA Engineers. Within Kualitee, users can access multiple projects, each containing various test cases and team members. The ab ...

What is the best way to continuously execute the 'onclick' function using AJAX inside a specific ID?

My challenge involves implementing a new AJAX upload feature to insert a data element from the onClick event in multiple rows. The issue I am facing is that it works fine for the first row, but when I add subsequent rows, the function no longer works upon ...

Tips on automating clicking the cookie button using Selenium?

Currently, I am attempting to extract data from the following website. I need to access various subpages, but some of them are hidden behind a "load more" button. I decided to use Selenium to click the button, but I am encountering difficulty with getting ...

Show button image beyond the limits of the hyperlink

Is it possible to create a button with a background image that changes on hover and when active, while also having the active state display an image that extends beyond the anchor's bounds? Check out my sprite here: The top half of the sprite represe ...

Tips for locating direct children of a non-root element using CSS selectors in Selenium

When working with a <table> element, I encountered the need to search for its descendants and direct descendants while avoiding wading through nested tables. The elements I seek lack reasonable IDs, so specific selectors are essential: <html> ...

Tricking Vuejs into triggering a @change event

I possess the following: <input type="radio" :name="activity" v-model="activity" :value="1" v-on:change="callProc(data, data2)" required> Ho ...