Tips for creating scrolling fixed elements beyond the full body width

I'm currently working on a final assignment for my class, which involves creating a basic webpage to learn about using local storage. However, I am encountering some challenges at an early stage of the process since I am still quite new to this. I have been utilizing fixed divs for the main structure of the webpage and now I am unsure how to add more content. I attempted to use the 'inherent position' but it resulted in everything going wrong.
the code: https://codepen.io/ipanonima/pen/WNbNeJm

Here is the HTML body:

<body>
    <div class="main">
      <div class="main-bar">
        <div class="main-bar-container">
           <div class="main-bar--logo">
              <img src="./public/logo.png">
          </div>
          <div class="main-bar--info-container">
            <div class="main-bar--info-container--buttons">
                <div class="main-bar--info-container--buttons--b"><p>Button</p></div>
                <div class="main-bar--info-container--buttons--b"><p>Button</p></div>
                <div class="main-bar--info-container--buttons--b"><p>Button</p></div>
            </div>
            <div class="main-bar--info-container--login">
                <div class="main-bar--info-container--login--b"><p>Login</p></div>
            </div>
          </div>
        </div>
      </div>
      <div class="example-section">
        <div class="example-section--pictures" id="ex1">
          <div class="example-section--pictures-pic"><img src="./public/canada-example.jpg"></div>
          <div class="example-section--pictures--overlay"><div class="overlay--text">Canada</div></div>
        </div>
        <div class="example-section--pictures" id="ex2">
          <div class="example-section--pictures-pic"><img src="./public/mexico-example.jpg"></div>
          <div class="example-section--pictures--overlay"><div class="overlay--text">Mexico</div></div>
        </div>
        <div class="example-section--pictures" id="ex3">
          <div class="example-section--pictures-pic"><img src="./public/eu-example.jpg"></div>
            <div class="example-section--pictures--overlay"><div class="overlay--text">USA</div></div>
        </div>
      </div>
      <div class="banner-session"></div>
    </div>
  </body>

Below is my CSS (which has become quite lengthy)

    *{
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
}
input{
    border: none;
    border-bottom: 2px solid #74b5fa;
    background-color: rgba(250, 167, 116, 0);
  }
.box-session{
box-sizing: content-box;
  position: relative;
etc...

Thank you for your patience!

Answer №1

It appears there may be some confusion regarding the fixed position. Despite that, you can easily add more content to your website. Experiment with setting

.new { height: 2000px; background: orange;}
and observe how the orange wall appears while the site continues to scroll. Keep in mind that since your header is also fixed, any additional content you include (such as an <h1>) will appear below it.

Remember, the fixed banners are positioned relative to the screen, meaning they move down as you scroll and overlay any content you introduce.

If you're unsure why you initially set them as fixed, consider removing that choice. Instead, assign a fixed height to the example images and allow scrolling (consider changing your header to sticky rather than fixed). After completing these modifications, take some time to further explore CSS positions by visiting this resource on CSS positioning.

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

Modify the CSS class by adding attributes dynamically instead of directly to the element

I encountered a situation where I needed to apply a css property to a class rather than an element. For example: $('.class_with_css').css({display:'none'}); This code would add the style "display:none" to all elements with the cl ...

Beginner in CSS Structuring

Hey there, I'm facing a bit of a challenge and could really use some guidance. I'm trying to design a layout for a website with specific components, but I can't seem to achieve the exact look I want. I know it should be straightforward, but ...

Unexpected Error in Applying Color to Rows in EXTJS Grid

Currently, I am utilizing extjs 3.2 and recently experimented with a sample for coloring grid rows by referring to . I added a grid view configuration in the gridExample.js file which holds a static grid. viewConfig: { stripeRows: false, get ...

Header escapes div and continues to move

I am currently working on building a website. One of the key features I want to include is a fixed top bar that remains visible at all times. In this bar, I have added buttons, an image, and a headline. However, I am facing an issue where the headline keep ...

`The height attribute of the textarea element is not being accurately adjusted`

When I tried to match the width(178px) and height(178px) of my table to the width and height of a text area upon clicking a button, I encountered an issue. While setting the width works perfectly fine, the height is being set to only 17px. It seems like ...

Create CSS styles for various sections with a minimum height of 100% and include a sticky footer for

Many people have asked about creating a sticky footer and main containers with 100% min-height. But how can I achieve this for multiple sections, ensuring each one has a 100% min-height while still pushing the footer below? Currently, my sections are set ...

What strategies can be implemented to enhance accessibility for custom table behavior?

Our team is currently working on a customized web application for a client's specific needs regarding data tables. The requested functionality includes the ability to sort table columns by clicking on the header, which has already been successfully im ...

LESS — transforming data URIs with a painting mixin

Trying to create a custom mixin for underlining text, similar to a polyfill for CSS3 text-decoration properties (line, style, color) that are not yet supported by browsers. The idea is to draw the proper line on a canvas, convert it to a data-uri, and the ...

The text decoration feature in CSS is not functioning correctly

I have been working on implementing text differencing in JavaScript using a specific code, and so far, it has been working well. Recently, I attempted to enhance the display by adding a text-decoration that would show a line over incorrect parts of the se ...

Acquire HTML using Java - certain characters are not retrieved accurately

Currently, I am facing an issue with my Java code when trying to fetch HTML from Turkish webpages. It seems that my Java code is struggling to recognize certain Turkish characters. Below is the Java code snippet I am using: import java.io.BufferedInputStr ...

I have organized two <h4>, <img>, and <p> tags into individual <div> elements. To prevent overlap, I floated the image and used <br> tags to create separation between the <div> elements. However, they still overlap despite these efforts

Arranging two h4, img, and p tags within separate <div> elements, I attempted to use float for the image and tag for separation. However, they are still overlapping. https://i.sstatic.net/SUxli.png Here is the image displaying the issue. I' ...

Problem with selecting odd and even div elements

I have a div populated with a list of rows, and I want to alternate the row colors. To achieve this, I am using the following code: $('#PlatformErrorsTableData').html(table1Html); $('#PlatformErrorsTableData div:nth-child(even)').css(" ...

Retrieve the ID of the image element using Jquery from a collection of images within a div container

I'm encountering a simple issue that I can't seem to solve. I am working on a basic slider/gallery with the following functionalities: 1) "If button 1 is clicked, image one will appear." 2) "Clicking on button 2 will make IMAGE 1 slide left and I ...

Is it possible to alter the color of an icon image using CSS?

I'm currently exploring ways to modify the color of an image that has a transparent and solid color split. My goal is to change the white portion for hover effects, and create a dynamic way to alter colors within WordPress without relying on Photosho ...

Guide to setting a white background color specifically for a lightbox in Angular

I want to change the background-color to white for my gallery items. Currently, I am using the following code to open the full-screen view: this.lightbox.open(0, 'lightbox1', { panelClass: 'fullscreen'}) Can someone please guide me on ...

Tips for establishing a custom thumbnail and title for HTML audio or video in the Chrome media control menu and Windows media control dialog

Is there a way to display the thumbnail and title of audio or video in HTML in the Chrome media control menu and Windows media control menu (where a dialog appears when the volume up or down key is pressed)? Chrome Menu https://i.sstatic.net/oLDgK.png W ...

Clicking on a select box causes the scrollbar area to vanish, shifting all the page content to the right

I have successfully implemented overflow-y: scroll; to keep the scrollbar space always reserved and prevent content from shifting when the scrollbar appears. However, I noticed that when I click on a select element, this scrollbar space is lost. How can I ...

What is the process for inserting HTML and CSS through the editor on DNN? Can markup be incorporated without the need for modules?

At my workplace, I do not have direct Host or Superuser access to DNN, and unfortunately, it is against company policy to grant me access to those accounts. This poses a challenge when trying to get my HTML/CSS to function correctly within the DNN HTML edi ...

What is the method for inserting line breaks in Ionic2 toasts using HTML?

Is there a way to include new lines and other HTML tags in a toast message? let toast = this.toastCtrl.create({ message: "First line<br />Second line.", duration: 5000, dismissOnPageChange: true }); toast.present( ...

Adjust the dimensions of the react-dropdown-tree-select element to better fit your needs

Hey there, I'm a beginner web developer currently working on a tree-based dropdown menu. Check out the documentation here To see it live in action, visit the example here I'm trying to adjust the height and width of the "Search/DropDown bar" in ...