About the font application in web design (4) Practical application

Source: Internet
Author: User

Hello, everyone. It's me again ~

Sorry for letting everyone wait for so much time. It has been busy recently. However, I will try my best to tell you something about it. You are welcome to continue to pay attention to it.

Last time I talked about the application I encountered in the actual application of font-family · on "href =" http://www.cnblogs.com/ruxpinsp1/archive/2008/05/11/font-in-front-end-development-3.html "target =" _ blank "> browser compatibility issues. This time I will talk about how to arrange the font family in the operating system. In addition, because the choice of Chinese characters is too small, the content of the design in this chapter should take the western text as the main body, compare with Chapter -3.html "href =" http://www.cnblogs.com/ruxpinsp1/archive/2008/05/11/font-in-front-end-development-3.html "target =" _ blank ">" solution 2 "in the previous chapter ".

-Common fonts for different operating systems

How can you make your fonts look consistent on any system or computer?

The principle is simple. Try to use fonts that exist in all operating systems. Although it sounds simple, it is still a tricky thing. To solve this problem, you must first understand the fonts of common operating systems.

Below I will list some default fonts for common operations except windows. Windows ...... You should be familiar with it.

-Common fonts in Mac OS X

A typical installed Mac OS X 10.4 contains the following commonly used Spanish fonts (some of which are not listed ):

Sans-serif Serif Monospace
Helvetica Times Courier
Arial Times New Roman Courier New
Arial Narrow Georgia  
Arial Black    
Comic Sans MS    
Gill Sans    
Impact    
Trebuchet MS    
Verdana    
Lucida Grande    
-Typical Linux Fonts

A typical Linux system only has kernel, so you must install the font on your own.

In this case, it is naturally impossible to correctly predict the fonts installed by Linux users. However, we will install some common fonts, so there will be no major problems.

 

-Compare the fonts of each operating system, we will find that --

In fact, common fonts for windows are available in other operating systems, and many people think windows only Arial fonts are no exception ~

Many designers think that Arial is not an elegant font, so they hope to replace it with a more classic Helvetica font on Mac, so this code is generated:

Font-family: Arial, Helvetica, sans-serif;

However, because Mac OS also has the Arial font, it will always show only Arial

In fact, this problem can be solved with a slight modification:

Font-family: Helvetica, Arial, sans-serif;

 

But things are often not that simple. For example, the above Mac OS X Font table contains a Lucida Grande font. This font is Mac only, so you should be able to write it with confidence:

Font-family: "Lucida Grande", Arial, sans-serif;

Then Mac users can see Lucida Grande, while PC users can see Arial fonts. A good example of application.

But in fact, many PC users see Garbled text instead of Arial fonts.

What's going on? Because there are many font download websites on the market, and there is the Lucida Grande download above. Unfortunately, this widely-spread Lucida Grande is a rip version, and there are defects in the rip, resulting in all line breaks will be displayed as a garbled code ......

-- Large

Don't say that this will only happen to users with English fonts. The version that can display on XP is not a rip version. The widely spread version on the Internet also has similar defects, but it is not serious enough to generate garbage codes. So pay attention to it when selecting the font.

-Introduction to common Spanish Fonts

Tahoma 16px Tahoma 14px Tahoma 12px

Tahoma is my favorite non-lined font. First, this font is installed on almost all systems by default, so there will be no compatibility issues. Second, this font is also balanced, and the display Section is also good.

 

Verdana 16px Verdana 14px Verdana 12px

To be honest, Verdana is too wide and is not suitable for mixing Chinese and English. In many cases, a letter in Verdana is wider than a Chinese character of the same size. Foreign designers like to use Verdana, most of the time because Verdana below 11px is indeed very good, but many domestic designers do not want to copy it, and use it on the layout of 12px or even 14px, as a result, the space for the local promotion is more intense, so it is not recommended to use font-family as the leading font.

If you want to use the Verdana font, you must consider the size gap between it and the general system default sans-serif font. Verdana is much larger than Helvetica or Arial. Fortunately, this font will be installed by default in almost all systems ......

 

Trebuchet MS 16px Trebuchet MS 14px Trebuchet MS 12px

Trebuchet MS is a font that many people will ignore. In fact, I personally appreciate this font. Instead of using Verdana, it is better to use a more rounded font. It also provides good support for various operating systems.

The disadvantage is that it is the same as Verdana because it is too wide and is not suitable for Chinese and English mixing. Pay attention to the gap between the font width and the default sans-serif font.

Because some Linux systems may not install this font, if you want to start with a font-family, you can use Verdana for subsequent fonts.

 

Arial 16px Arial 14px Arial 12px

The default sans-serif font in Windows. The default font will never be used.

 

Helvetica 16px Helvetica 14px Helvetica 12px

Why is Helvetica so elegant? Even if it is used at the beginning of font-family, it will be able to stand alone.

In addition, there is a flash game with Helvetica and Arial ~ Just step on the Arial character like a super Mary. By the way, if there is no Helvetica font, let's take a look at the differences between the two fonts ~ Tea ~

 

Georgia 16px Georgia 14px Georgia 12px

My favorite serif font. It is not only suitable for text, but also for titles. Especially in ItalyGeorgia ItalicIt is even more attractive. The disadvantage is that it is not suitable to mix Chinese characters, because Georgia's line is too heavy for, so it looks hard ......

 

Times New Roman 16px Times New Roman 14px Times New Roman 12px

The default serif font for Windows. There's nothing to say, the old man of the Spanish font. Many fonts, such as Courier New, are derived from Times New Roman.

However, this font is rarely used in the print industry, and more is used by its descendants-Times Europa and Times Europa Office.

In the specific webpage font application, note that Times New Roman with the same font size is much smaller than normal fonts, so you must consider the font size changes.

 

Courier New 16px Courier New 14px Courier New 12px

One of the common equal-width fonts. In fact, the selection of the same width font is relatively small, so it is basically necessary to be compatible with all systems, so you can only select this font.

But fortunately, the same width font is usually useful when writing code, so as long as the same width is no big problem. Fonts similar to Lucida Sans Typewriter, Lucida Console, and Monaco are also very useful.

-To sum up, we will summarize several practical and simple sets of font-familyfont-family: Tahoma, Helvetica, Arial, sans-serif;

Tahoma neutral font. We recommend that you use an environment above 13px.

 

Font-family: Trebuchet MS, Verdana, Helvetica, Arial, sans-serif;

Verdana wide font. We recommend that you use it in environments below 11px.

 

Font-family: Geogia, Times New Roman, Times, serif;

The best choice for line fonts.

 

Font-family: Lucida Console, Monaco, Courier New, mono, monospace;

A series of equal-width fonts. It is easy to write code. In addition, if you think the Lucida Console is too wide, you can replace it with a relatively narrow Lucida Sans Typewriter. The code block on Lao Zhao's blog uses Lucida Sans Typewriter ~

-Do you know?
  • Font alias

    A font in the system allows multiple aliases. For example, in windows, Georgia can also be named by Georgia MS, which is actually the same font. The official name of is SimSon, while "on" is only its alias.

    According to the specifications, the browser should be able to automatically identify the font alias and map it to the correct font file. For example, font-famliy: SimSon and font-family: "" should have an equivalent effect. Unfortunately, it seems that many browsers cannot correctly execute the previous definition ......

  • When should I quote the font name with quotation marks?

    Let's take a look at the font style definition:

    Font-family: Times New Roman,, serif;

    Many people will say that this style is written incorrectly, because Times New Roman and should both be enclosed in quotation marks, as shown below:

    Font-family: "Times New Roman", "", serif;

    In fact, both of the above statements are correct. Unlike many people think, the quotation marks outside the font name are not necessary. What is the difference between quotation marks and no quotation marks?

    In fact, the biggest difference lies in the interpretation of the blank characters (such as spaces and tabs) in the font name.

    When no quotation marks are added, the browser should interpret the blank characters in the font name in the same way as in XML, that is, ignore the blank characters around the font name, the blank characters in the middle of a word are interpreted as spaces. For example, font-family: Times New Roman, serif; will be interpreted as font-family: Times New Roman, serif;

    When quotation marks are added, the browser must retain all the blank characters in the quotation marks. If it is written as font-family: "Times New Roman", the browser does not display the Times New Roman font, but searches for a font called "Times New Roman.

    For font names such as "", because there are no blank characters in the middle, there is no need to enclose them with quotation marks. However, considering that not all the operating systems support Chinese characters, and not all programmers will pay attention to the correct encoding of css files, quotation marks are generally added for the sake of safety. Of course, the best way to solve this problem is to use aliases. For example, should actually be written as SimSon, so that even if the viewer's system does not support Chinese characters and the css file is incorrectly encoded into GB2132, the browser still knows that this is, make a proper font search. Unfortunately, not all browsers support this ......

 

This topic is about the font application in web design. I hope it will help you. Next time, I plan to explain how to apply style sheet management in projects. It is suitable for those who are a little bit familiar with style sheet basics and are participating in or interested in large-scale development projects ~ Some small articles may also be interspersed to explain some misunderstandings encountered in actual work. However, it may be a little busy recently, so it may take some time to write. Please wait.

So, you will see it next time ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.