Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
245 views
in Technique[技术] by (71.8m points)

html - How to lock text onto an image without it moving around?

Im trying to figure out how to lock text onto a specific part of an image, so that if the image moves the text will move with it and stay in the same place relative to the image. this is the code i have so far. The text is only in the correct place relatively to the background on my computer, but when uploaded, the background will move. How do i stop the background from changing size on different webpages? Or how can i make sure that the text stays in the correct place on the image?

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.links {
font-smooth:never;
 font-size:11px;
 color:Black;
 font-family: arial;

</style>
<style>
body {
    background-image: 
url('https://64.media.tumblr.com/19bdc0c46a2919225d00518b4239ef85/8b9ee5db2cd2c1f2-3d/s1280x1920/5808f94f9307445928bde5188ff2f16cbb363193.jpg');
    background-size: 100% 480%;
    background-repeat: no-repeat;
    color:#cccccc;
}
</head>
</style>
<body>
<b>
<br />

<p class= links><p style="font-smooth:never;
 font-size:11px;
 color:Black;
 font-family: arial; position:fixed; right:675px; bottom:559px; width:200px; height:50px; border:none; text-decoration: none"><font color="black">Thatkiddvee- Stuck_With_You </p>

<p class= links><a href= "https://distrokid.com/hyperfollow/thatkiddvee/stuck-with-you" style="position:fixed; right:675px; bottom:552px; width:200px; height:50px; border:none; text-decoration: none"><font color="black">Stuck_With_You</a> </p>
   
 <p class= links><a href= "https://youtu.be/Oj7_R31LV1k" style="position:fixed; right:675px; bottom:534px; width:200px; height:50px; border:none; text-decoration: none"><font color="black">Stuck_With_You (Music Video)</a> </p>


<p class= links><p style="font-smooth:never;
 font-size:11px;
 color:Black;
 font-family: arial; position:fixed; right:627px; bottom:507px; width:250px; height:50px; border:none; text-decoration: none"><font color="black">Thatkiddvee- Love_Don't_Cost_A_Thing </p>

<p class= links><a href= "https://youtu.be/qnzU3UhDQb8" style="position:fixed; right:675px; bottom:502px; width:200px; height:50px; border:none; text-decoration: none"><font color="black">inspo.mp4</a> </p>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just change your background-size to cover.

background-size: cover;

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.links {
font-smooth:never;
 font-size:11px;
 color:Black;
 font-family: arial;

</style>
<style>
body {
    background-image: 
url('https://64.media.tumblr.com/19bdc0c46a2919225d00518b4239ef85/8b9ee5db2cd2c1f2-3d/s1280x1920/5808f94f9307445928bde5188ff2f16cbb363193.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    color:#cccccc;
}
</head>
</style>
<body>
<b>
<br />

<p class= links><p style="font-smooth:never;
 font-size:11px;
 color:Black;
 font-family: arial; position:fixed; right:675px; bottom:559px; width:200px; height:50px; border:none; text-decoration: none"><font color="black">Thatkiddvee- Stuck_With_You </p>

<p class= links><a href= "https://distrokid.com/hyperfollow/thatkiddvee/stuck-with-you" style="position:fixed; right:675px; bottom:552px; width:200px; height:50px; border:none; text-decoration: none"><font color="black">Stuck_With_You</a> </p>
   
 <p class= links><a href= "https://youtu.be/Oj7_R31LV1k" style="position:fixed; right:675px; bottom:534px; width:200px; height:50px; border:none; text-decoration: none"><font color="black">Stuck_With_You (Music Video)</a> </p>


<p class= links><p style="font-smooth:never;
 font-size:11px;
 color:Black;
 font-family: arial; position:fixed; right:627px; bottom:507px; width:250px; height:50px; border:none; text-decoration: none"><font color="black">Thatkiddvee- Love_Don't_Cost_A_Thing </p>

<p class= links><a href= "https://youtu.be/qnzU3UhDQb8" style="position:fixed; right:675px; bottom:502px; width:200px; height:50px; border:none; text-decoration: none"><font color="black">inspo.mp4</a> </p>
    </p></p></b></body></head></html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...