html设置字体
```html body { fontfamily: 'Arial', sansserif; fontsize: 16px; } .mycustomfont { fontfamily: 'Times New Roman', serif; fontsize: 20px; fontweight: bold; }
This is a paragraph with the default font.
This is a paragraph with a custom font.
2. 运用外部CSS文件创立一个外部CSS文件(例如 `styles.css`),并在HTML文档的 `` 部分引用它。
```css/ styles.css /body { fontfamily: 'Arial', sansserif; fontsize: 16px;}.mycustomfont { fontfamily: 'Times New Roman', serif; fontsize: 20px; fontweight: bold;}```
```html
This is a paragraph with the default font.
This is a paragraph with a custom font.
3. 运用 `@fontface` 规矩假如你想要运用自界说字体,你能够经过 `@fontface` 规矩来界说它。
```css@fontface { fontfamily: 'MyCustomFont'; src: url;}
body { fontfamily: 'MyCustomFont', sansserif;}```
```html@fontface { fontfamily: 'MyCustomFont'; src: url;}
body { fontfamily: 'MyCustomFont', sansserif;}
This is a paragraph with the custom font.
保证 `mycustomfont.ttf` 文件坐落正确的途径,而且浏览器能够访问到它。
4. 运用内联款式你还能够直接在HTML元素上运用 `style` 特点来设置字体。
```html
This is a paragraph with inline styles.
以上是一些根本的HTML字体设置办法。你能够根据需要调整字体类型、巨细、款式等特点。
设置字体称号