10

I want to create an A4 style page in HTML. However I want it to look the same whenever I zoom in and out. For example look at the following screenshots:

Normal ZoomZoom Out

When I zoom out, the paragraph looks longer inside the page. What I want is a Word Style zoom in and out.

Here is the way this page is coded:

<div class="document">
<div    class="page">
    <div class="content">
        <h1>Hello World</h1>

        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
    </div>
</div>

CSS Code:

body {
    margin: 0;
    padding: 0;
    background-color: grey;
}


.page{
    margin:auto;
    margin-top:50px;
    width:210mm;
    height:297mm;
    background-color:white;
    border:1px solid black;
    padding:0px;
}

.content{
    background-color:   orange;
    margin:10%;
}
msmechanized
  • 436
  • 4
  • 19
  • 5
    +1 for visual description and good question format. – 0x5C91 Sep 16 '14 at 15:21
  • Did you try setting the exact font size in pixels for your content? – Floremin Sep 16 '14 at 15:36
  • 2
    Here is a question with scaling relative to container options http://stackoverflow.com/questions/16056591/font-scaling-based-on-width-of-container – ltotally Sep 16 '14 at 15:51
  • 4
    Your code works fine on my Chrome 37 on Windows. Only the last zoom out to 25% distorts the text to fill up more of the page. I think it's just related to how Chrome handles small font sizes. This renders fine on IE 11 in all zoom levels. – Floremin Sep 16 '14 at 15:56
  • 1
    @Floremin Looking at this in firefox, it does a similar thing. Still the layout of the page would change. – msmechanized Sep 16 '14 at 16:28
  • @Floremin Post as an answer if you'd like – Zach Saucier Sep 16 '14 at 18:39

1 Answers1

2

Webkit browsers (like Chrome or Opera) try to resize the text on low zoom (like 25%) to make it readable. If you look at the computed css you will notice that the font size is changing, even if you define it in your css. You would need a plugin, that disables this resizing.

100% zoom in chrome

100% zoom chrome

25% zoom in chrome

25% zoom chrome

Internet Explorer dont resizes the font-size on low zoom

ie