Home / ASP.NET Wiki / Javascript / How to adjust font size?

How to adjust font size?

 Rate It (0)

In this post you will see how can we change the font size on the fly.

Style.css

.bodyContent14
{
FONT-SIZE: 13px; LINE-HEIGHT: 14px
}

.bodyContent16
{
FONT-SIZE: 15px; LINE-HEIGHT: 16px
}

Page.aspx

function doZoom(size)

{

   var o = document.getElementById(”bodyContent”).className = ”bodyContent” + size;

}

The text inside the Div will change and  adjust Font size 16 to 14.

Revision number 2, Sunday, May 03, 2009 5:20:07 PM by victorgirotto

Comments

Great article! I´ve been wondering how to do that! Thanks!

could be more specific on how to use the code is very difficult for beginners, thanks

Try including some more details on what it is doing when you call that function and taht it needs the css class for each fontsize or it needs to include validation so a user or developer does not exceed the limit of the font size

please describe a bit more clearly

Currently, it will adjust two font size only, it should be Generic.

Adjust Font size User this href="doZoom(16)" in the hyper link.

Please explain how to use it . u know a bit more descriptive..

Shortcuts

Table of Contents

Top Wiki Contributors

(last 30 days)

  1. abiruban (1)