How to set font on picture in html

藏色散人
Release: 2023-01-03 09:26:49
Original
18981 people have browsed it

htmlHow to set the font on the picture: First, create a div in the html file; then set a picture and text h1 in it; then pass "h1{position:absolute;top:20px;left: 10px;}" to move the text above the image.

How to set font on picture in html

The operating environment of this article: windows7 system, HTML5&&CSS3 version, DELL G3 computer.

In the html file, first create a div, and then set an image and text h1 inside, as shown in the picture

How to set font on picture in html

The style after opening It's like this, as shown in the picture, the picture is at the top and the text is at the bottom

How to set font on picture in html

Then simply modify h1, modify the text size font-size and text color

How to set font on picture in html

As shown in the picture, the effect is like this now, so that when the words are moved to the picture, the words will not go out of range.

How to set font on picture in html

If you want to move the words above the picture, you need to position it here. Set div as parent and relative positioning; set h1 as absolute positioning:

div{position:relative;} h1{font-size:16px;color:red;position:absolute;top:20px;left:10px;}
Copy after login

How to set font on picture in html

After setting it like this, as shown in the picture, the final effect is like this, the text content has been moved to the top of the picture.

How to set font on picture in html

【Recommended:HTML video tutorial

The above is the detailed content of How to set font on picture in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!