Locking the size of the text in a html page to exact px size

A forum for, well, anything really.
Gripes, moans, ideas or just general chit chat. EXCEPT SPAM!!! - Don't just register to post here - IT WILL GET DELETED!!!
Post Reply
User avatar
4viggo
Super Advanced
Super Advanced
Posts: 56
Joined: Wed Jun 12, 2002 12:03 pm
Location: Norway

Locking the size of the text in a html page to exact px size

Post by 4viggo »

Is it possible to lock the size of text in a browser window so the user can't change it using the text size option of the browser :?: The same way you can lock the size of the text in the menu using px :roll:
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Yup, using CSS (cascading style sheets). If you dont know what they are or how to use them, google the term and you will get alot of tutorials and examples. Then once you know how to use them, in the head of your document, you could do something like.

Code: Select all

<STYLE type="text/css">
body{
  font-size: 12px;
}

table{
  font-size:  10px;
}
</STYLE>
This would force all the text in your page to be 12px, no matter what....unless you override it somewhere. Thats why its called cascading style sheets, because things take a style from parent objects but styles closer to the object get presidence. The above example shows this...it would make sure everything is 12px big in the body (everything on the page), but the table tag overrides it so the text in your tables would be slightly smaller. This allows you to lock in different sizes for different situations.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Also, you can specify pixel values for fonts in the menu style.

We use fontsize="75%" so that the menu will change but you can use fontsize="12px" if you like.

Cheers
Andy
User avatar
4viggo
Super Advanced
Super Advanced
Posts: 56
Joined: Wed Jun 12, 2002 12:03 pm
Location: Norway

Post by 4viggo »

Thanks a lot, i will have to dig into style cheets then. I've been trying to avoid them as long as i could, but now i'm googling away :lol:
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Believe me, you dont want to avoid them. They are one of the most powerful ways to style and customize your site, as well as the most dynamic and flexible. You will be very glad you know how to use them when you do.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply