您可以在HTML中嵌入字体而不链接到外部源吗?
我需要在HTML页面中使用字体,但我也需要它脱机工作,当我的电脑上没有互联网连接的项目。既然我可以从Google Fonts下载您可以在HTML中嵌入字体而不链接到外部源吗?,html,css,fonts,Html,Css,Fonts,我需要在HTML页面中使用字体,但我也需要它脱机工作,当我的电脑上没有互联网连接的项目。既然我可以从Google Fonts下载.ttf文件,有没有一种方法可以在不从Fonts.googleapis.com导入字体的情况下实际包含字体?你当然可以这样做。在.css文件中使用@font-face @font-face { font-family: 'FontName'; src: url('FontName.eot'); /* IE9 Compat Modes */ src: url(
.ttf
文件,有没有一种方法可以在不从Fonts.googleapis.com
导入字体的情况下实际包含字体?你当然可以这样做。在.css文件中使用@font-face
@font-face {
font-family: 'FontName';
src: url('FontName.eot'); /* IE9 Compat Modes */
src: url('FontName.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('FontName.woff2') format('woff2'), /* Super Modern Browsers */
url('FontName.woff') format('woff'), /* Pretty Modern Browsers */
url('FontName.ttf') format('truetype'), /* Safari, Android, iOS */
url('FontName.svg#svgFontName') format('svg'); /* Legacy iOS */
}
URL将相应地指定,这取决于字体所在的文件夹相对于CSS文件。您当然可以这样做。在.css文件中使用@font-face
@font-face {
font-family: 'FontName';
src: url('FontName.eot'); /* IE9 Compat Modes */
src: url('FontName.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('FontName.woff2') format('woff2'), /* Super Modern Browsers */
url('FontName.woff') format('woff'), /* Pretty Modern Browsers */
url('FontName.ttf') format('truetype'), /* Safari, Android, iOS */
url('FontName.svg#svgFontName') format('svg'); /* Legacy iOS */
}
URL将相应地指定,具体取决于字体所在的文件夹相对于CSS文件。我相信您可以在服务器/本地存储中包含字体,并使用本地链接,而不是URL
@font-face{
font-family: /*name here*/
font-style: normal
font-weight: 250
src: url('') /* replace with local link/ format*/
}
请参阅:有关详细信息我相信您可以在服务器/本地存储中包含字体,并使用本地链接,而不是url
@font-face{
font-family: /*name here*/
font-style: normal
font-weight: 250
src: url('') /* replace with local link/ format*/
}
请参阅:以了解更多详细信息