Browser Setting

Tamer_Ahmed

Centurion
Joined
Dec 20, 2003
Messages
159
Location
Egypt
hi every one
sometimes if the user to change the text size in the browser to large my site become so ugly so how to make the font's size never i change i saw sites doing this
 
Tamer_Ahmed said:
hi every one
sometimes if the user to change the text size in the browser to large my site become so ugly so how to make the font's size never i change i saw sites doing this

You could use CSS (cascading style sheets) to give your elements fonts and sizes.

For example, if you do this:

Code:
<p style="font-size: 9pt;">blah blah blah</p>

...then the font size of that paragraph won't change.

There's several ways to do CSS. Usually you'd want to define page-level styles and classes or link to an external stylesheet. For example, if you were to put this inside the <head></head> tags on your page:

Code:
<style type="text/css">
    td { font-family: Arial; font-size: 9pt; }
</style>

...then all TD elements on your page would be size 9 Arial. If you setup a style using a basic element name the style gets applied to all elements of that type.

A simple CSS class might look like this:

Code:
<style type="text/css">
    .Arial9 { font-family: Arial; font-size: 9pt; }
</style>

...which you might use like this, giving a class attribute to an html element:

Code:
<p class="Arial9">This paragraph would appear in 9pt Arial font</p>

<table><tr><td class="Arial9">Displays in Arial 9pt</td></tr></table>

...and so on...

If you view source on this page (and most pages) you'll see a large <style> declaration and/or some references to externally linked stylesheets. Externally linked stylesheets are nice because it lets you reuse the styles and style classes you define - so you can apply them to as many pages as you want.

There are lots of websites that go into the details of CSS.

Paul
 
Last edited:
Back
Top