Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML make fonts scale the same way as the page

Tags:

html

css

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%;
}
like image 906
msmechanized Avatar asked Sep 16 '14 15:09

msmechanized


People also ask

How do I automatically adjust font size in HTML?

The font-size-adjust property gives you better control of the font size when the first selected font is not available. When a font is not available, the browser uses the second specified font. This could result in a big change for the font size. To prevent this, use the font-size-adjust property.

How do I make all fonts the same in HTML?

You can use a <basefont> tag to set all of your text to the same size, face, and color. The font tag is having three attributes called size, color, and face to customize your fonts. To change any of the font attributes at any time within your webpage, simply use the <font> tag.

How do I change font size and position in HTML?

Output: Approach 4: Using separate CSS to select the required text and using the font-size property to change the font size. The size value can be set using length units or keywords like x-small, small or large.

Why is my font size not changing in HTML?

To change the font size in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-size. HTML5 do not support the <font> tag, so the CSS style is used to add font size.


1 Answers

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

like image 183
Basti Destruction Avatar answered Sep 21 '22 15:09

Basti Destruction