Skip to main content
Known Participant
Feb 3, 2023 9:11 PM UTC
Answered

Get Rid of Need for Scrolling Left/Right Desktop

Why can't I get rid of the need to scroll left/right here? I tried this

max-width: 100%;
    overflow-x: hidden;

 

I tried taking out the side phone number. 

But that didn't fix it either. 

 

 

https://carthagemills.com/index-test.php

This topic is closed to new replies. Start a new post to keep the conversation going.
osgood_Correct answer
Legend
Feb 3, 2023 9:59 PM UTC
quote

Why can't I get rid of the need to scroll left/right here? I tried this

max-width: 100%;
    overflow-x: hidden;

 

I tried taking out the side phone number. 

But that didn't fix it either. 

 

 

https://carthagemills.com/index-test.php


By @acobbcarthagemills

 

Change the width of your #header_logo css from 100% to 200px as shown below. The logo image in that div is set to 200px so the div should be set to 200px:

 

#header_logo 
absolute top: 5px; left: 40px; right: 0; width: 200px; z-index: 990; padding-right: 5px;
 
Just so you understand what's happening - You have set the width of the header_logo container to 100% and have also set a left position of 40px. That makes the container more that 100% hence the scrolling right. box-sizing: border-box; only takes into account padding/margin
 
You could also use css calc to calculate the width if for some reason you need the header logo container to be 100%.
 
width: calc(100% - 40px);
 

5 replies

osgood_Correct answer
Legend
Feb 3, 2023 9:59 PM UTC
quote

Why can't I get rid of the need to scroll left/right here? I tried this

max-width: 100%;
    overflow-x: hidden;

 

I tried taking out the side phone number. 

But that didn't fix it either. 

 

 

https://carthagemills.com/index-test.php


By @acobbcarthagemills

 

Change the width of your #header_logo css from 100% to 200px as shown below. The logo image in that div is set to 200px so the div should be set to 200px:

 

#header_logo 
absolute top: 5px; left: 40px; right: 0; width: 200px; z-index: 990; padding-right: 5px;
 
Just so you understand what's happening - You have set the width of the header_logo container to 100% and have also set a left position of 40px. That makes the container more that 100% hence the scrolling right. box-sizing: border-box; only takes into account padding/margin
 
You could also use css calc to calculate the width if for some reason you need the header logo container to be 100%.
 
width: calc(100% - 40px);
 
Translate
Known Participant
Feb 3, 2023 10:05 PM UTC

Thanks osgood!

Translate
Nancy OShea
Community Expert
Community Expert
Feb 3, 2023 10:26 PM UTC

I'm glad you got it working.  But don't forget about those markup errors as they can lead to other problems with layout, etc... 😉 

 

Translate
Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
Feb 3, 2023 9:53 PM UTC

With linked stylesheets disabled, it still requires horizontal scrolling which implies it's coming from someplace other than CSS.

 

Start by fixing the myriad markup errors & warnings, 358 reported below.

https://validator.w3.org/nu/?doc=https%3A%2F%2Fcarthagemills.com%2Findex-test.php

 

 

Translate
Nancy O'Shea— Product User & Community Expert