How to put text in image HTML
HTML Tutorial » How to put text in image HTML
1. Create a container for the image and make it’s position relative.
2. Place the image inside container.
3. Place the text immediately below the image within the container and make it’s position absolute and place it as you like.
4. The last, add some CSS tricks.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.container {
position: relative;
text-align: center;
color: white;
}.text_bottom-left {
position: absolute;
bottom: 8px;
left: 16px;
}.text_top-left {
position: absolute;
top: 20px;
left: 40px;
}.text_top-right {
position: absolute;
top: 8px;
right: 16px;
}.text_bottom-right {
position: absolute;
bottom: 8px;
right: 16px;
}.text_centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body><h2>Put Text on Image</h2>
<p>How to place text over an image:</p><div class="container">
<img src="img_snow_wide.jpg" alt="Snow" style="width:92%; padding:10px">
<div class="text_bottom-left">My Text Bottom Left</div>
<div class="text_top-left">My Text Top Left</div>
<div class="text_top-right">My Text Top Right</div>
<div class="text_bottom-right">My Text Bottom Right</div>
<div class="text_centered">My Text Centered</div>
</div></body>
</html>
Related subjects:
How to put text in image HTML
How to insert text in HTML code using javascript dynamically
How to add text in HTML
How do I put text over an image in HTML?, How do I put text onto a picture?, How do I put text in the middle of an image in HTML?
How to place text on image using HTML and CSS? - example
We use CSS position property to set the position of your text over image.
This can be done by enclosing the image and text in an HTML “div”.
<!DOCTYPE html>
<html><head>
<style>
.img-class {
margin: 3%;
position: relative;
}.first-txt {
position: absolute;
top: 17px;
left: 50px;
}.second-txt {
position: absolute;
bottom: 20px;
left: 10px;
}
</style>
</head><body>
</html>
<div class="img-class">
<img src="my_img.jpg">
<h3 class="first-txt">
Add here your text over image
</h3>
<h3 class="second-txt">
Add here your title over image
</h3>
</div>
</body>
Tags: How to put text in image html, insert, place, how to put text in picture in html, put text below imageTags: put text in front of image, above image, under image, inside img, behing img , How to place text over an image:
How to Position Text Over an Image Using CSS, Text Blocks Over Image CSS
How to put text in image HTML - html tutorial
This tool makes it easy to create, adjust, and experiment with custom colors for the web.

Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.

Find here examples of creative and unique website layouts.

Find here examples of creative and unique website CSS HTML menu.