Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML body not filling complete width on mobile devices [closed]

Tags:

html

css

mobile

If I open my (GWT) page in a normal browser, everything works fine. The body takes the whole width and the content is nicely centered. But if I try this on a mobile phone, the body does not take the whole width and therefore the content is not centered.

I couldn't find out why it is being displayed like this. Also, adding 100% width to body and html tag does not solve the issue .

Is there a way to get this working nicely on a mobile device?

The page can be reached under: http://www.vegantastic.de/ enter image description here

like image 848
jan Avatar asked May 20 '15 19:05

jan


People also ask

How do you make a full width element in HTML?

Just use top:0; and left: 0; and you can also eliminate padding: 0 . Don't use top: 0; for other div except top, use left: 0; for other div for eliminate the left space.

How do I force a div to full width?

What you could do is set your div to be position: absolute so your div is independent of the rest of the layout. Then say width: 100% to have it fill the screen width. Now just use margin-left: 30px (or whatever px you need) and you should be done.


1 Answers

this was driving me crazy and i just solved it by adding position:fixed to the body

like image 77
milpool Avatar answered Sep 21 '22 01:09

milpool