Unchanging bottom section with changeable information

I have a unique website design in mind that involves using an image as the background and placing the content within a box. View my website design here

However, I am facing an issue with a specific page on this website. The page contains accordion buttons that expand the content beyond the boundaries of the container. My goal is to keep the container size fixed while allowing the content to overflow it.


Here is the relevant code:

CSS

.background {
    background-image: url(/recources/images/page-background.png);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    height: 100vh;
    width: 100%;
    padding: 98px;
}

.web-content {
  display: table;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.web-content_row {
  display: table-row;
  height: 100%;
}

.web-content_row .web-content_height {
  overflow-y: auto;
  max-height: 100%;
  height: auto;
}

HTML

<body class="background">
  <section class="web-content">
    <div class="web-content_row web-content_height">
      <header>
        <!-- Header content -->
      </header>

      <section class="web-content_tutorials-menu">
        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>

        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>

        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>

        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>

        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>
      </section>
    </div>

    <footer>
      <!-- Footer content -->
    </footer>
  </section>
</body>

When an accordion button is clicked, the content expands beyond the page's boundaries, causing issues with the footer and container. I want the content to overflow the container without affecting its size. Additionally, the scroll bar does not appear when the content exceeds the view height.

I have tried troubleshooting this issue myself and suspect that it may be related to the display: table; and display: table-row; properties in the CSS code.

If anyone has a solution to prevent the content from expanding the footer and container, I would greatly appreciate your input.

Thank you for your understanding as this website has a unique design that poses challenges not commonly encountered.

Sincerely,
Hexsphere

Answer №1

My approach would be to maintain the existing HTML structure:

body {
  background: tomato; /* Simulates the photo background */
}

.web-content {
  background: #fff;
  width: 80vw;
  height: 70vh;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: auto;
}

footer {
  position: fixed;
  height: 10vh; /* change according to your preference */
  width: 80vw;
  background: aqua; /* funky colors are my jam */
  left: 10vw; /* (100 - 80) / 2 */
  bottom: 15vh; /* (100 - 70) / 2 */
}
<body class="background">
  <section class="web-content">
    <div class="web-content_row web-content_height">
      <header>
        <!-- Header content -->
      </header>

      <section class="web-content_tutorials-menu">
        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>

        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>

        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>

        <button class="accordion-button">Title</button>
        <div class="panel">
        </div>

        <button class="accordion-button">Title</button>
        <div class="panel">
        foo<br>bar<br>foo<br>bar<br>
        foo<br>bar<br>foo<br>bar<br>
        foo<br>bar<br>foo<br>bar<br>
        foo<br>bar<br>foo<br>bar<br>
        foo<br>bar<br>foo<br>bar<br>
        </div>
      </section>
    </div>
  </section>
  <footer>
    <!-- Footer content -->
    Fixed footer heehaa
  </footer>
</body>

I trust this solution will meet your needs!

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

Adjust the navigation text and logo color as you scroll on the page

I am new to HTML and CSS and I am working on a website with PagePiling.js scrolling feature. I want to change the color of my logo image and navigation text dynamically as I scroll to the next section. Specifically, I only want the part of the logo and tex ...

Seamless border that flows through several elements

I'm currently working on integrating line numbers into a code snippet. I've managed to get it functioning, but there's an issue with the border between the line number and the code. Instead of being continuous, there are small, unsightly gap ...

The continuation of unraveling the mystery of utilizing `overflow-y:scroll` in a horizontal slider

As a beginner, I realized too late that adding code in comments is not an option. Consequently, I decided to create a new question and ask for your assistance once again. To optimize the use of space, I have implemented bxSlider with fixed dimensions (wid ...

Tips on avoiding blurring when making an autocomplete selection

I am currently working on a project to develop an asset tracker that showcases assets in a table format. One of the features I am implementing is the ability for users to check out assets and have an input field populated with the name of the person author ...

Searching for various values in PHP with user input

I am currently working on implementing a basic search tool that allows users to search the database by providing certain inputs. The form consists of 3 input fields: However, when I attempt to search one by one, only the first field functions correctly w ...

Utilizing the DirectusImage tag for a stylish background effect

I'm new to Directus and I need help styling a card with a background image from a Directus Image. Can anyone guide me on how to achieve this? Here's what I have tried: <Card style={{backgroundImage:"url({someColletion.image.id})" &g ...

The issue of jQuery's .last() function triggering multiple times with just a single click on the last

I currently have a set of tabs containing radio buttons and I need to trigger an event when the last option is selected (meaning any radio button within the final tab, not just the last radio button). Below is the HTML code: <div id="smartwizard" clas ...

Cut an image using CSS while maintaining its original quality

I am currently working on an upload page where users can upload images. Here is the link to the page: MyPage. However, I would like to implement image cropping functionality that displays more of the image rather than just a small portion as it does now. A ...

Creating a Runescape Tracker: What essentials should I include?

Hello everyone, I am a beginner in the world of programming and I am excited to learn. I have heard that the best way to learn is by working on a project. I have always been interested in creating a Skill Tracker for my clan. Can you offer any advice on wh ...

Getting rid of the arrow icons in a Material UI TextField

I am facing a challenge with removing the up and down arrow icons from a Material UI TextField that I adjusted using the Material UI documentation (https://material-ui.com/components/autocomplete/#autocomplete) Highlights section. After trying various sol ...

Avoiding double entries in the shopping list using DOM selectors in JavaScript

I have been struggling with preventing duplicate items from being added to a shopping list that I created. Even though I thought the code below would solve the issue, it hasn't been effective so far. My expectation was for the JavaScript code to acces ...

What is the best way to remove the empty space on the right side of a webpage while ensuring it remains responsive?

I noticed that there seems to be some extra space on the right side of the layout. I'm not sure how to adjust the Bootstrap code or CSS to fix this issue, or if I need to apply margin 0 or padding 0 somewhere in the code. * { box-sizing: border-b ...

Tips for avoiding HTML <tags> in the document.write function

I am trying to paint the actual HTML code within a tag using JavaScript but escaping it doesn't seem to be working. function displayHTMLString(n){ document.write("'<table>'"); for (i in range(0,n)){ ...

The 3D Circle Flip feature on a certain webpage designed by Nordstrom is experiencing issues when viewed on Firefox

Click here to see a 3D Circle Flip effect. It works correctly in Chrome, but in Firefox the text does not change when flipping. ...

Do I need to utilize a Form element?

<p>text 1<span>additional information 1</span><span>more details</span></p> <p>text 2</p> <a> hyperlink </a> <button>submit</button> <p>yet another paragraph</p> Greeting ...

Issue with conditional comment in IE 8 not functioning as expected

Struggling with changing the SRC attribute of my iFrame specifically for users on IE 8 or older. This is the code I have written: <script> var i_am_old_ie = false; <!--[if lte IE 8]> i_am_old_ie = true; <![endif]--> </script> ...

What could be causing the Google Chrome inspector to insert strange ID attributes into various HTML elements?

Currently, I have a page set up on my localhost with the following code: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Times</title> <style type="text/css" media="screen"> input{font:1.5e ...

Some pages are receiving images from the CDN, while others are not

I am encountering some challenges while troubleshooting an issue on a website. The CDN (content delivery network) is functioning properly on some pages but not on others. Initially, I suspected a typo in the path, but that does not seem to be the case. F ...

What is causing my button to act in this way?

Initially, the website redirects to an undefined URL and then to test.com. I am looking for a way to implement a redirection sequence from to and finally to <head> <script type="text/javascript"> <!-- function popup(url ...

"Filtering and extracting particular form elements to be sent to the $_POST superglobal array

Currently, I have a table filled with data that is editable by administrators. There is a submit button to apply all changes, but I am interested in knowing if it is possible to only send the data that has been modified. One idea is to add a checkbox that ...