WEB DESIGN GARAGE [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

WEB DESIGN GARAGE [Electronic resources] - نسخه متنی

Marc Campbell

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Chapter 47. Controlling the Typeface


Normally, a browser displays text in its default typeface or font, which is almost always Times New Roman on Windows computers. HTML offers the creaky font tag to let you change the typeface for a particular section of text. The font tag works like this:


<p>
<font face="Arial">This paragraph displays in Arial.</font>
</p>

The value of the face attribute is the name of the font that you want to use.

You may play with the position of the font tags to apply the font to several text elements in a row:


<font face="Arial">
<h1>This header displays in Arial.</h1>
<p>So does this paragraph.</p>
<p>So does this paragraph.</p>
</font>

But now that CSS is here, you don't need the font tag. The font-family attribute performs the same function. You can add it to the style definition of an HTML tag:


p {
font-family: Arial;
}

or a class style:


.arialtext {
font-family: Arial;
}

CSS makes typeface management easier, too. If you define a style rule so that all paragraphs display in Arial, as in the first CSS example, you can forget about those annoying font tags. Whenever you add a paragraph to your page, it automatically displays in Arial.


TIP


If the name of a font contains multiple words, like Times New Roman or Courier New, make sure you put the name in quotes in the CSS style definition.

It gets better. Let's say you want all the text on a page to display in Arial. Simply put the font-family attribute in the style rule for the body tag:


body {
font-family: Arial;
}


/ 175