- AMP:Building Accelerated Mobile Pages
- Ruadhan O'Donoghue
- 229字
- 2021-07-08 10:04:10
Using custom fonts to improve page design
Now that we know how to add custom fonts, let's apply some to our content. We'll use a sans serif font, PT Sans, for our navigation links, and a serif font, Droid Serif, for our main paragraph text (both chosen from Google Fonts). First, we'll add the include-link that Google Fonts generated when we chose the fonts; this gets added to the head of the page (/ch3/fonts.html):
<link rel="stylesheet">
Now we just have to apply these to the relevant elements of our page. For the navigation links, use the following:
.primary-nav li {
font-family: "PT Sans", sans-serif;
}
And we'll apply Droid Serif to all other text:
body {
font-family: "Droid Serif", serif;
}
Finally, let's stick with Georgia for our logo and h1 texts. Note that we don't need to include Georgia explicitly, as it's available on most systems, but we can provide a fallback in any case:
.logo, h1 {
font-family:Georgia, "Times New Roman", serif;
}
This resulting page should look something like the following image:

- Practical Data Analysis Cookbook
- Java多線程編程實(shí)戰(zhàn)指南:設(shè)計(jì)模式篇(第2版)
- Visual Basic 6.0程序設(shè)計(jì)計(jì)算機(jī)組裝與維修
- Mastering Swift 2
- Python全棧數(shù)據(jù)工程師養(yǎng)成攻略(視頻講解版)
- Oracle GoldenGate 12c Implementer's Guide
- MySQL程序員面試筆試寶典
- Qlik Sense? Cookbook
- Python語言科研繪圖與學(xué)術(shù)圖表繪制從入門到精通
- Spring Boot從入門到實(shí)戰(zhàn)
- Monitoring Docker
- 你必須知道的.NET(第2版)
- ASP.NET jQuery Cookbook(Second Edition)
- 微信公眾平臺開發(fā)最佳實(shí)踐
- C++程序設(shè)計(jì)習(xí)題與實(shí)驗(yàn)指導(dǎo)