Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my html page has a default width?

I am trying to change an website from fixed layout to a responsive layout but I am having problems setting up the html width. As you can see in the image below the width of html tag is 980px even if the page is empty, no css or js, just the html tags and doctype (the head and body are added automatically by browser): html width defaults to a value

For testing I am using the Google Chrome Dev Emulator set up as Apple Iphone, I also tested on a phone and still the page looks too big for the screen. Do you have any idea what to change to make my html tag width vanish?

like image 262
Mihai Crăiță Avatar asked Jan 13 '14 20:01

Mihai Crăiță


People also ask

How do I fix the width of my HTML page?

To convert it to a fixed-width layout, simply add a fixed with to the #wrapper and set the margins to auto. Setting the margins to auto will cause the left and right margins to be equal no matter how wide the browser window is, which will cause your fixed-width layout to be positioned in the center of the browser.

Why there is default margin in HTML?

Adjusting the Margin Size of an HTML Element With CSS This margin is automatically created by some browsers to allow for space between the edges of the viewport and the website content. You can remove this margin by setting the top and left margin to zero.

What is the default width in HTML?

There is no default value of HTML width attribute.

What is the default width of a web page?

The standard webpage size uses a maximum width of 1440 pixels for Desktops. This is because most desktop resolutions use a wider resolution nowadays (1920x1080). However, most websites are fully responsive nowadays, which means they won't use fixed dimensions.


1 Answers

It's your Dev Emulator. According to the Safari Web Content Guide by Apple (under "Examples of Viewports on iOS"), the default size of the viewport of the iPhone is 980px. The Dev Emulator is then...emulating that page size for you. If you want to make it go away, just turn off the emulator or adjust any settings it may have.

like image 69
BrianH Avatar answered Sep 28 '22 09:09

BrianH