mardi 25 août 2015

Scale down a webpage to 90%

When you press Ctrl+- on any browser, the page scales down to 90% of it's original size. I need to replicate that, and open my webpage at 90% of it's original by default, instead of 100% because it looks nicer at 90%.

I tried the most common approach as mentioned here, here, and here, all of which basically tell you to add this block of code in your css.

html
{
    zoom: 0.9; /* Old IE only */
    -moz-transform: scale(0.9);
    -webkit-transform: scale(0.9);
    transform: scale(0.9);
}

The problem with this is that it creates a gap on the left and the right sides, as well as a huge gap on the top, which aren't present when you manually reduce the size by doing a ctrl+-.

This is what happens when I use the above mentioned code - notice the gaps on the left, right, top. This is what happens when I use the above mentioned code

While this is what I want - this is what happens when you do a ctrl+ - manually in your browser. While this is what I want - this is what happens when you do a ctrl -.

How do I go about this?




Aucun commentaire:

Enregistrer un commentaire