Tips for avoiding my photobanner from being truncated on a webpage and ensuring there is an automatic scrollbar

My website used to have photobanners displayed horizontally with the ability to scroll through them, but after accidentally deleting some code, I realized that now the images are cut off at the edge of the webpage without a scrollbar. How can I restore the original functionality?

I attempted to force a scrollbar using html {overflow: scroll;}, but it didn't work as expected. Adding overflow: scroll; or :auto; directly to the photobanner also produced undesirable results. Even setting width: 100%; for the html div had no effect.

This is the relevant CSS:


#container1 {
width: 4000px;
overflow: hidden;
margin: 100px auto;
background: none;
}

/*header*/
header1 {
width: 1800px;
margin: -400px;
}

header1 h1 {
text-align: justify;
font: 100 60px/1.5 roboto condensed;

}

header1 p {
font: 100 15px/1.5 Helvetica, Verdana, sans-serif;
text-align: justify;
}

/*photobanner*/

.photobanner {
 height: 233px;
 width: 8550px;
 margin-left: -400px;
 margin-bottom: 80px;
 }

 .photobanner img {
 -webkit-transition: all 0.5s ease;
 -moz-transition: all 0.5s ease;
 -o-transition: all 0.5s ease;
 -ms-transition: all 0.5s ease;
 transition: all 0.5s ease;
 }

 .photobanner img:hover {
 -webkit-transform: scale(1.05);
 -moz-transform: scale(1.05);
 -o-transform: scale(1.05);
 -ms-transform: scale(1.05);
 transform: scale(1.05);
 cursor: pointer;

 -webkit-box-shadow: 0px 3px 5px rgba(0,0,0,0.2); 
 -moz-box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
 box-shadow: 0px 3px 5px rgba(0,0,0,0.2);
 }

And the HTML:

<div id="container">
<div style="float: top;">
<div style="margin-top: -475px;">
<div class="photobanner"><img alt="" class="first" height="575" src="LINK" 
/><img alt="" height="575" src="LINK" /><img alt="" height="575" src="LINK" 
/><img alt="" height="575" src="LINK" /><img alt="" height="575" src="LINK" 
/>
<p>___</p>
<h1>HEADER</h1>
<p>CAPTION</p>
</div>
</div>
</div>
</div>

An issue with my photobanner was mysteriously resolved when I temporarily removed a section from my HTML where I planned to build my header:

<body class='section-1'>
<div id='menu'>
<div class='container'>
<div align="center"><a href="https://terrichienyi.com/"><img src="https://66.media.tumblr.com/37c178aaab3ceab836b8136297132679/tumblr_pjqt2u 
lQ8R1xmt4ilo5_1280.png"></a>

<a href="https://google.com/" target=blank><img 
src="https://sc01.alicdn.com/kf/HTB1suoTg5qAXuNjy1Xdq6yYcVXaq/14inch-button- 
interface-small-size-color-tv.jpg_50x50.jpg"></a><a 
...
...
...

</div>

Unexpectedly, reordering this HTML snippet within my overall code did not solve the issue and sometimes disrupted the layout of the header. Removing it entirely fixes the problem, but I want to find a solution where the header remains intact while resolving the scrolling problem.

Answer №1

Consider implementing the max-width property

Switching from 'width' to 'max-width' can assist in achieving the full width of the browser window while maintaining responsiveness.

CSS -->

max-width: 100%;

Appreciate it

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

Resizing logo to fit Outlook desktop

https://i.sstatic.net/e34kS.pngWhen creating emails using a Drag & Drop editor in a CRM (Dynamics 365 with ClickDimensions), I encountered an issue with the logo not displaying correctly in Outlook desktop. Despite using inline styling, the logo appeared f ...

retrieve the value of an HTML element once it has been modified

When I am working in a view, I encounter an issue where I need to retrieve the value of an HTML input box after it has been changed. Initially, the page loads with the following code: <input id="input_one" type="text" value = "apple" /> Upon loadin ...

What is the optimal method for saving a dynamic webpage as an object?

In my current project, I am developing a PHP application that utilizes MySQL for the database. One of the features I want to include is a site builder using AJAX to load and store dynamic page content. The goal is to allow users to make changes to the site ...

Troubleshooting problem with ngb carousel timing interval

I am currently developing a web app for selecting maps in Escape from Tarkov. To enhance the visual appeal of the app, I decided to incorporate an ngb-carousel feature for a smooth animation effect. However, I have encountered a problem where the slides ar ...

Combining a left div, a right div, and a center div to equal 100% width. What is the best

I currently have a main div and three additional divs contained within it: <div id="container" style="width:100%;"> <div id="left" style="width:201px; float:left;"> .... </div> <div id="centre" st ...

How can you specify a "default" value for history.pushState and replaceState?

What value should be used in the title param for browsers to use their default settings? In Safari 5.1.7 (7534.57.2), using either null or undefined as the title param defaults to the browser's settings. However, Opera 12.16 interprets "null" and "u ...

What is the best way to utilize CSS relative positioning for aligning two rows of information on a webpage?

What is the best way to use relative positioning to show two lines of information on an image without the order of information interfering with each other? I want the Files badge to appear at the bottom of the image, with the MusicBrainz and Discogs badge ...

Experience the thrill of success with a timed animation using Sweet Alert on the powerful Ionic framework

I'm currently working with the ionic framework to develop a mobile application. I'd like to incorporate Sweet Alert for displaying success messages. You can find Sweet Alert at . My goal is to include a timer in the success message. swal("Good ...

Enable a single flex item to wrap across multiple lines

I have an HTML code snippet that needs to be styled using Flexbox. Specifically, I want to re-order the elements and create a 'line break' before the last item. How can I utilize Flexbox so that most flex items are treated as atomic units, but on ...

Modifying element size using jQuery causes issues with maintaining a 100% height

I am facing an issue with a sidebar that is styled using the following css properties: background:#164272; position:absolute; left:0px; top:70px; width:250px; height:100%; When I use jQuery to display a table that is initially hidden and on ...

Looking to leverage iframes in your Javascript code?

Currently, I am implementing a JSP popup window using JavaScript with an iframe to display a table of multiple records. However, when I disable the table of multiple records, it does not prevent the onclick function (hyperlink). The code snippet is provid ...

Can anyone provide guidance on utilizing libraries within a Chrome extension?

I have been attempting to implement this for a total of 10 hours and I am struggling to make it work in script.js. // Creating a button element const button = document.createElement('button'); button.textContent = 'copy'; button.addEve ...

What could be causing the cell containing my image to not resize along with the image?

I'm attempting to create a table with 4 cells, each containing an image. My goal is to use a test image for now and set the size of the image in percentage so that it resizes with the window. However, I am facing an issue where when I specify the imag ...

What is the best way to include two rows in a single INSERT statement?

For each product that a customer selects to purchase, I have set up a shopping cart to display these items. The requirement is to add each selected product as a separate row in the 'order_details' table with the same customer_id. Screenshot: htt ...

What steps should be taken to retrieve the contents of a file that has been chosen using the browse

You have successfully implemented a browse button that allows the user to navigate the directory and choose a file. The path and file name are then displayed in the text element of the Browse button complex. Now, the question arises - how can I extract dat ...

Transforming a Java Array or Collection into a JSON array

After running my Java code, the returned Collection (ArrayList) produces JSON through JAXB that looks like: {"todo":[{"name":"CAMPBELL","sales":"3","time":"1331662363931"}, {"name":"FRESNO","sales":"2","time":"1331662363931"}]} However, I am wondering if ...

The dynamic php form features a single set of buttons labeled Next and Before for easy navigation

I am in the process of creating a dynamic form using a single PHP file that displays and saves data from an SQL database. I now want to add two buttons, NEXT and BEFORE, but I have been having difficulty getting them to display or navigate to the next/prev ...

Create a stylish progress bar using CSS arrows

https://i.sstatic.net/vSPZ3.png I have a progress bar that is almost complete, but the arrow position is not working properly. I have tried using :before to fix it, but the position is still incorrect. <div class="progress-panel"> < ...

Eradicate white space in a JavaScript code

Calling all JS programmers! Here's a challenge for you, check out this demo: https://codepen.io/gschier/pen/jkivt I'm looking to tweak 'The pen is simple.' to be 'The pen issimple.' by removing the extra space after 'is& ...

The background color is failing to respond to the padding of the adjacent image

Check out this page to see the issue. The code snippet surrounded by pre tags has a background-color that is not aligning properly with the image, even though the image has a defined padding of 16 pixels on the right. The text alignment is correct, but the ...