Sunday, October 26, 2008

CSS: Changing Font

The font tag is not supported by HTML anymore but the browsers still support it. Hence It is better to switch over to CSS. Simply put CSS can do more to the tag. Added advantage is that Cascading Style Sheets can change the background color behind the text which traditional HTML font tag cannot do.

text is purple

All web design service should use CSS as it makes much more search engine friendly websites as well as accords much better appearance to the web page design on the browsers.

This is how fant face called family is defined in CSS.

Use this: this font is not sans-serif

Similarly for colors

Use this: Font is purple

While implementing CSS one should know how to change the font attributes - Font color, font size, and font face. Learning is easy and you will be surprised to know how much control CSS gives over fonts.

You can make your pages unique by proper usage of font properties defined in CSS.Change
color, size, and face of the website text using CSS font property.


To change the text color style.

color Syntax:

color: | attr(,color) |inherit

* - a color code
* attr(,color) - use the color value assigned to the attribute identified in this line

Best to use browser safe colors.
this font is colored red
this font is colored blue

While setting the font size define relative sizes or use pixels, cm or inches to make the size specific. But it is better to let the font size be flexible as users have different monitor confugeration and browser types. Best is to implement (em) meant for screen rendering.

Use the following style to change font size:

this font is 1em
this font is .75em this font is 1.25em

Using CSS define any font and specify a list of font faces as well in case the user does not have that specific font face installed in his PC the list will help declare other font face rather than the default setting which may not appealing.

this font is

sans-serif

this font is serif

No comments: