在CSS中,引用外部字体是非常重要的,它可以提高网站的可读性和视觉效果。但如果需要使用多个外部字体,应该怎么做呢?下面让我们来一起学习。首先,我们需要在CSS文件中定义@font-face规则,该规则
CSS @font-face { font-family: 'Roboto'; src: url('https://fonts.googleapis.com/css?family=Roboto&display=swap') format('woff2'); font-weight: normal; font-style: normal; }
CSS h1{ font-family: 'Roboto', sans-serif; }
CSS @font-face { font-family: 'Roboto'; src: url('https://fonts.googleapis.com/css?family=Roboto&display=swap') format('woff2'); font-weight: normal; font-style: normal; } @font-face { font-family: 'Lora'; src: url('https://fonts.googleapis.com/css?family=Lora&display=swap') format('woff2'); font-weight: normal; font-style: normal; } h1{ font-family: 'Lora', serif; } p{ font-family: 'Roboto', sans-serif; }
粉丝
0
关注
0
收藏
0