Hassan Baig
Hassan Baig

Reputation: 15804

Body width doesn't change

I'm making a fixed width (120px) website for old feature phones that don't respond to media queries. The width of the body won't change even when I've defined it as 120px. When I open the website on the phone, it shows a huge horizontal scroll bar showing me a lot of blank space on the right which I'm assuming is the body. In the screen shot attached, I've set background color of body to red so you can see the problem (I also had to blackout the content for client privacy). I'm using the following code:

html {

width:120x;
margin-left:0px;

}

body{
    width:120px;
    font-family: arial;
    font: arial;
    margin-left: 0px;
    max-width:120px;
}

enter image description here

Upvotes: 0

Views: 1322

Answers (4)

vinzcelavi
vinzcelavi

Reputation: 830

I think you have to use un child to wrap your content with a max-width.

and tags don't allow to do what you want.

HTML

<div class="wrapper">
    Your content goes here
</div>

CSS

html,
body {
    margin: 0;
    height: 100%;
}

.wrapper {
    box-sizing: border-box;
    position: relative;
    padding: 20px;
    width: 120px;
    height: 100%;
    font-size: 14px;
    background-color: #d63b24;
    color: #fff;
}

http://jsfiddle.net/vinzcelavi/1rx7yn57/

Upvotes: 0

Jaffer Wilson
Jaffer Wilson

Reputation: 7273

Try this

body {
    min-width: 1024px;
}

Here's your fiddle: http://jsfiddle.net/enxRw/1/

Upvotes: 0

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167172

Remove the typo:

html {
  width: 120px;
  margin-left: 0px;
}

Upvotes: 1

gopalraju
gopalraju

Reputation: 2309

I think you've a typo here:

html {

width:120x;
margin-left:0px;

}

The width should be 120px

Upvotes: 2

Related Questions