Experiencing a horizontal scroll while shifting the elements despite no visible overflow

While working on the contact section of my website, I encountered an issue. Every time I adjust the position of the textboxes and labels by 15em within the wrapper, a horizontal scroll appears. How can I move these elements without triggering the scroll bar?

function scrollDown() {
    window.scrollBy(0, 600);
}
*{
    margin: 0;
    border: 0;
    text-decoration: none;
    list-style: none;
    font-family: 'Roboto', 'Segoe UI', 'sans-serif';
    scroll-behavior: smooth;
}

a{
    padding: .3em;
    color: #000;
}

li{
    display: inline;
    position:relative;
    width: 74px;
    height: 21px;
    left: 130px;
    top: 71px;
    font-size: 18px;
    line-height: 21px;
}

li a:hover{
    color: #e48257;
    transition: .3s;
}

.title{
    font-weight: 700;
    font-size: 90px;
    position: absolute;
    width: 462px;
    height: 168px;
    left: 171px;
    top: 300px;
    white-space: nowrap;
    color: #252525;
}
span{
    color:#e48257
}
img{
    position: absolute;
    height: 455px;
    left: 763px;
    top: 190px;
}
button:nth-of-type(2){
    position: absolute;
    width: 110px;
    height: 45px;
    left: 310px;
    top: 526px;
    background: #333C54;
    border-radius: 20px;
    color: white;
}
button:nth-of-type(1){
    position: absolute;
    width: 127px;
    height: 45px;
    left: 171px;
    top: 526px;
    border: 1px solid #333C54;
    box-sizing: border-box;
    border-radius: 20px;
    background-color: white;
    
}
.about-us{
    position: relative;
    top: 54em;
}
.about-us-breadcrumb{
    position: absolute;
    width: 75px;
    height: 21px;
    left: 171px;
    top: 23px;
    font-family: Roboto;
    font-style: normal;
    font-weight: bold;
    font-size: 18px;
    line-height: 21px;
    color: #8E8E8E;
}
.about-us-text{
    position: absolute;
width: 530px;
height: 210px;
left: 171px;
top: 60px;
...

<!DOCTYPE html>
<html lang="en">
<head>
...
</footer>
<script src="app.js"></script>
</body>
</html>

Apologies for the messy code, as this is my first attempt at this. Really, really sorry. This additional text is to satisfy Stack Overflow's code-to-text ratio requirements. Unfortunately, I can't provide more meaningful text due to these limitations. Sorry once again.

Answer №1

The div you have styled with the "form" class is currently set to display: block, causing it to expand to the full width of its container, which in this case is the entire page.

However, by adding left: 15em, you have shifted the div to the right, extending it beyond the page width.

To address this issue, there are two simple solutions:

You can switch the display property to display: inline-block

Alternatively, you can specify a precise width using calc() like so: width: calc(100% - 15em)

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

Preventing jQuery from matching multiple elements

I'm currently working on implementing a rollover effect using jQuery. I've encountered an issue due to the fact that I'm trying to execute a mouseover event on an object containing a link. The specific scenario involves a level-2 navigation ...

Expanding divs in CSS for multiline versus single line text content

I am attempting to display text within a bordered div that is positioned absolutely inside another div. Option 1 using width:auto; - view fiddle: https://jsfiddle.net/c21kt6r4/ The issue here is that the box on the left side expands excessively. https:// ...

The CSS list formatting does not seem to be compatible with Bootstrap 4

For my website, I am working on creating a table using the list method along with CSS. However, I encountered a problem where the table is not displaying correctly when Bootstrap CDN is applied. Removing Bootstrap CDN resolves the issue, but I need to keep ...

Code that achieves the same functionality but does not rely on the

I utilized a tutorial to obtain the ajax code below. The tutorial referenced the library jquery.form.js. Here is the code snippet provided: function onsuccess(response,status){ $("#onsuccessmsg").html(response); alert(response); } $("# ...

Modifying icon color upon button click in Vue 3: A quick guide

I'm currently implementing Vue 3 into my project. Within the database, there are a total of 10 individuals, each of which should have their own card displayed. Users have the ability to add any person to their list of favorites. Below is the code snip ...

Showcase JSON data within a designated div

As someone new to HTML, JavaScript and Vue, I'm unsure if my issue is specific to Vue or can be resolved with some JavaScript magic. I have a Node.js based service with a UI built in Vue.js. The page content is generated from a markdown editor which ...

Creating a custom dynamic favicon and title in NextJS

Hello there! I am in the process of creating a web constructor. Currently, my application functions as follows: I verify the URL that the user is visiting (such as localhost:3000) I identify their project name within my web constructor (localhost:3000 -&g ...

Achieve a stylish layout by displaying three cards per row using Vue.js and Bootstrap 4

I'm facing an issue with my code where I am trying to display Bootstrap cards in rows of three, but the layout is not rendering correctly. It starts with one card, then two, and eventually adds a new column, resulting in some empty spaces with offsets ...

Trick for adjusting padding on top and bottom for responsive blocks of varying widths

Hello there, I've been working on a project where I need to create a responsive grid of cards, like news articles, that maintain their proportions even when the browser's width changes. To achieve this, I decided to use an aspect-ratio hack by s ...

How can we modify the position of a header from fixed to relative when the mobile drop-down menu is opened?

I am experiencing an issue with my responsive design. When viewed on a device that is less than 600px wide, the drop-down multi-level navigation overflows downward and does not scroll because the header has a fixed position. As a result, the tabs in the me ...

String constant without an ending

My Description has a single quote character('). How can I make sure it doesn't break the code? <a href='javascript:select("<%= pageBean.replace(list.getColumn(0), "'", "'") %>", "<%= pageBean.replace(list.getColumn(1), ...

Enhancing the menu/navigation bar with individual AJAX loaders

I have chosen the Vivant Designs theme for our website, which can be found at What I am looking to achieve is an ajax loader that will appear next to the link or tab when a user clicks on a link within the drilldown menu located on the left side. The cont ...

"Select2 dropdown fails to function properly upon returning to the page using the browser's

I've encountered an issue while working on a search page with Select2 dropdowns. Everything functions smoothly upon the initial page load, however, problems arise when a user performs a search, hits the browser back button, and then revisits the page. ...

Switch Bootstrap Tab

I have successfully implemented a bootstrap tab on my webpage and it is functioning as intended. Now, I am interested in adding an additional feature to the tabs. My question is, is it possible to toggle the content area if the same tab is clicked again? ...

What methods do HTML document Rich Text Editors use to incorporate rich text formatting features?

I am curious about the way text in the textarea is styled in rich-text editors. I have attempted to style text in the form but it doesn't seem to change. How does JS recognize the characters typed by the user? Can you explain this process? Edit: Aft ...

Is there a way to retrieve the background URL from CSS using Selenium Webdriver?

I am attempting to verify the URL of an image within a div element's background property in the CSS for the webpage. However, when I retrieve the CssValue and display it, it appears to be blank. The HTML structure for the div is as follows: <div ...

The mobile display does not support scrolling in Material-UI Drawer

I recently implemented the React Material UI library and integrated the Drawer component as a side-bar menu in my project. However, I encountered an issue where the Drawer component does not support scrolling on mobile devices. You can check out the websi ...

Resize the div based on the width and height of the window

My goal is to create a system or website that can be fully resizable using CSS and the VW (viewport width) unit. Within this system, I have integrated a GoogleChart that functions with pixels. Now, I am looking for a way to scale the chart using Javascript ...

Consolidate duplicate list entries and adjust the CSS as needed

Imagine I have an array like this: myarray = ["apple", "apple", "apple", "potato", "apple"]; myarray = ["apple", "apple", "apple", "potato", "apple"]; function listCreate(data) { var output = '<ul>'; $.each ...

What is the correct placement of DESC in a MySQL query when using PHP?

Here's the issue I'm facing: $query = "SELECT * FROM table ORDER BY 'timestamp' LIMIT $startAt, $perPage"; I've been attempting to sort the results in descending order (latest on top) by adding DESC to the query. However, every t ...