css3 @font-face_html/css_WEB-ITnose
For a long time, web designers have always had to use some "web-safe" fonts. Now @font-face can load server-side font files, allowing the browser to display fonts that are not in the user's computer. Installed fonts.
The principle is: the font file is placed on the web server and automatically downloaded to the user's computer when needed.
1. Introduction to @font-faceSyntax:
@font-face { font-family: <YourWebFontName>; src: <source> [<format>][,<source> [<format>]]*; [font-weight: <weight>]; [font-style: <style>]; }
Parameter description:
YourWebFontName: This value is your own defined font name , it's best to use the default font name you downloaded, which will be referenced in the font-family attribute of your web element.
source: The storage path of the custom font, which can be a relative path or an absolute path.
format: refers to the format of the custom font, which is mainly used to help the browser identify it. Its values have the following types: truetype, opentype, truetype-aat, embedded-opentype, avg, etc.
Font-weight and font-style define whether the font is bold and the font style.
Browser compatible writing:
@font-face { font-family: 'YourWebFontName'; src: url('YourWebFontName.eot'); /* IE9 Compat Modes */ src: url('YourWebFontName.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('YourWebFontName.woff') format('woff'), /* Modern Browsers */ url('YourWebFontName.ttf') format('truetype'), /* Safari, Android, iOS */ url('YourWebFontName.svg#YourWebFontName') format('svg'); /* Legacy iOS */ }
1. Download special fonts
For example, I want to download single-malta.font For this font, the download link is
http://www.dafont.com/single-malta.font
After downloading and decompressing, you can see a ttf file.
2. Use third-party tools to generate the font format required by @font-face, that is, .eot, .woff, .ttf, .svg font formats:
Third-party tool link: http: //www.fontsquirrel.com/fontface/generator
The specific steps are to upload the font downloaded in the first step on the WEBFONT GENERATOR page, and then download and decompress it.
After downloading and decompressing, I found that the folder has a lot of redundant demo pages and css. We only need four files: .woff, .ttf, .svg, and .eof. Copy these four files to the site's fonts directory. The preparations are now complete.
3. Add @font-face related code in style.css.
4. You can now use font-familyl in styles.
The code is as follows:
<style type="text/css">@font-face { font-family: 'SingleMaltaRegular'; src: url(fonts/singlemalta-webfont.eot); src: url(fonts/singlemalta-webfont.svg#SingleMaltaRegular)format('svg'), url(fonts/singlemalta-webfont.ttf)format('truetype'), url(fonts/singlemalta-webfont.woff)format('woff'), url(fonts/singlemalta-webfont.eot?#iefix)format('embedded-opentype'); font-weight: normal; font-style: normal;}h2.singleMalta { font-family: 'SingleMaltaRegular'}</style><body><h2>普通字体</h2><h2 class="singleMalta">single malta</h2></body>
Effect:
Detailed explanation of the @font-face attribute for importing special fonts into web pages
http://www.w3cfuns.com/thread-5597432-1-1.html
Get fonts
http://www.google.com/fonts /
http://www.dafont.com/
Third-party font generation tool
http://www.fontsquirrel.com/fontface/generator

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...
