AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL
HTML Tutorial

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.

Example: a simple code, change parameters

<!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”.

Example:

<!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>
<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>

</html>

 

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

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


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


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


HTML Img Background
HTML Image Link
HTML Image Size
HTML Text Style
HTML Text Align
HTML Text Size
HTML Text Color Style
HTML Text Color
HTML Table Color
HTML Table Row Colspan
HTML Table Width
HTML Table Style
HTML Table Border
HTML Table
HTML Font Face
HTML Font Size
HTML Font Color
HTML Headings
HTML div border color
HTML div class
HTML class container
HTML form action
HTML comment
HTML link new tab
HTML link underline
HTML link tag
HTML button action
HTML button onclick
HTML button link
HTML table style
HTML image
HTML colors
HTML div style
Text, paragraf in HTML
HTML Tags Attributes
HTML - Elements
HTML Introduction
Home HTML Tutorial
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


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


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Send forgot password by mail or message ...
PHP MySQL simple login system...
Check for duplicate username live or ema...
How to create simple search engine using...
Diseño de sitio web CSS Layout...
Diseño de caja flexible CSS3...
Botones en CSS...
ID y Clase, Diferencias entre Class e Id...
Esquina redondeada CSS...
Tamaño de caja css box-sizing: border-b...
Alineación CSS...
Altura y Anchura CSS...
Bordes CSS...
Margen CSS...
Relleno CSS...
Modelo de caja CSS...
Tablas CSS...
Listas CSS...
Enlaces CSS...
Texto CSS...