2 replies [Last post]
Knutsford-Software
Knutsford-Software's picture
Offline
newbie
united kingdom
Last seen: 1 year 50 weeks ago
united kingdom
Timezone: GMT+1
Joined: 2011-04-26
Posts: 5
Points: 9

body {	
	margin: auto;
	padding-bottom:5%;
	padding-left:0%;
	padding-right:0%;
	padding-top:5%;
	background-color:#FAE8B3;	 
	font-size: 16px;
	color: #FF9554;	
	font-weight:bold;
	max-width: 100%; 	
	width: auto;
}

For some reason that I can't work out the above has a horizontal scroll bar when viewing on a mobile. Can anyone see why please. Thanks

pavithraramesh
pavithraramesh's picture
Offline
newbie
Chennai
Last seen: 5 years 5 weeks ago
Chennai
Timezone: GMT+5.5
Joined: 2018-01-15
Posts: 5
Points: 5

margin and padding

Hi,

I don't see any problem in the code. Probably there is some default padding or margin of HTML.

Try adding these codes before body

* {padding:0; margin:0;}
html {padding:0; margin:0;}

Try this and please let me know if it works.

Regards,

Pavithra Ramesh
Spidergems

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 3 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

First guess

Without seeing the page in totality, guessing is all we can do.

My guess is that something in the page has an intrinsic width wider than the viewport. For example, an image or a table, or any element with a too wide absolute dimension.

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.