p { font-size: 16px; } </style> </head> <body>
段落1
<p class="<em>custom-font</em> first-of-type { font-style: italic; } /* 段落2: 不继承 body 的字体,但颜色相同 */ .<em>custom-font</em> important 强制覆盖 */ } </style> </head> <body> <p>段落1</p> <p class="custom-font">段落2Hard Stones Sans Strip'; src: url('webfont.ttf') format('truetype'); } .custom-font user/font-face) 自定义的字体 */ font-size: 80px; } </style> </head> <body> <p class="<em>custom-font</em>
展示如何自定义背景颜色和字体大小: <style> .custom-bg { background-color: #ffcc00; /* 自定义背景颜色 */ } .custom-font
这个文本使用了自定义字体大小。
这样,您可以根据项目需求轻松自定义全局 CSS 样式。Hard Stones Sans Strip'; src: url('webfont.ttf') format('truetype'); } .custom-font 使用 @font-face 自定义的字体 */ font-size: 80px; } </style> </head> <body> <p class="<em>custom-font</em>
/IndieFlower.ttf"); } .custom-font{ font-family: IF; } 1) 自定义字体@font-face 2) font-family: IF; 远程字体的引用: <link rel="stylesheet" type="text/css" href="http://xxx.com/xxx.css"> .custom-font
.custom-font { font-family: 'MyVariableFont'; font-variation-settings: 'wght' 600, 'ital' 1; } 61.
.custom-font { font-family: 'MyVariableFont'; font-variation-settings: 'wght' 600, 'ital' 1;
这是一段使用自定义字体的文本。