One trick to teach you how to use css to add background images to HTML fonts (code sharing)

奋力向前
Release: 2021-08-15 15:04:02
Original
7846 people have browsed it

In the previous article "Teach you step by step how to use css to add border effects to HTML fonts (code sharing)", I introduced you how to use css to add border effects to HTML fonts. The following article will introduce to you how to use css to add a background image to HTML fonts. Let's see how to do it together.

One trick to teach you how to use css to add background images to HTML fonts (code sharing)

Let’s first look at the final effect

One trick to teach you how to use css to add background images to HTML fonts (code sharing)

How to add in the font Background image?

1. When opening the html, first write the div tag. Between

and , enter the code
time will also abandon him
.

Code example

   给字体添加图片 
时间也抛弃他
Copy after login

Code effect

One trick to teach you how to use css to add background images to HTML fonts (code sharing)

The code output result, the font is too small, I want to enlarge the font, how to enlarge it? Use the font-family attribute to set the font style of text. Don’t forget to writeCode example