Skip to main content
Known Participant
February 3, 2023
Answered

Get Rid of Need for Scrolling Left/Right Desktop

  • February 3, 2023
  • 2 replies
  • 474 views

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 has been closed for replies.
Correct answer osgood_
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);
 

2 replies

osgood_Correct answer
Legend
February 3, 2023
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);
 
Known Participant
February 3, 2023

Thanks osgood!

Nancy OShea
Community Expert
Community Expert
February 3, 2023

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... 😉 

 

Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
February 3, 2023

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

 

 

Nancy O'Shea— Product User & Community Expert