- Online javascript image slideshow generator simple html image slideshow code, upload your images and create css animated slideshow.
- Generate an HTML image element to display any image on your website using our online HTML generator tool. Preview live and copy the code to your website.
A background image can be specified for almost any HTML element.
Background Image on a HTML element
Html Image Marquee Code Generator
To add a background image on an HTML element, use the HTML
style
attribute and the CSS background-image
property:Example
Add a background image on a HTML element:
<div>
The ultimate web code generator. Generate HTML5, CSS3, Microdata, JSON-LD, Twitter Cards, Open Graph and more! No coding skills required. Create HTML image maps. Choose an image from your computer and highlight areas to create the HTML required for your image. Generated HTML Output Definition and usage The tag is used to define a client-side image-map. An image-map is an image with clickable areas. The required name attribute of the element is associated.
Try it Yourself »You can also specify the background image in the
<style>
element, in the <head>
section:Example
Free Html Image Code Generator
Specify the background image in the
<style>
element: <style>
div {
background-image: url('img_girl.jpg');
}
</style>
Try it Yourself »div {
background-image: url('img_girl.jpg');
}
</style>
Background Image on a Page
If you want the entire page to have a background image, you must specify the background image on the
<body>
element:Example
Add a background image for the entire page:
<style>
body {
background-image: url('img_girl.jpg');
}
</style>
Try it Yourself »body {
background-image: url('img_girl.jpg');
}
</style>
Background Repeat
If the background image is smaller than the element, the image will repeat itself, horizontally and vertically, until it reaches the end of the element:
Example
<style>
body {
background-image: url('example_img_girl.jpg');
}
</style>
Try it Yourself »body {
background-image: url('example_img_girl.jpg');
}
</style>
To avoid the background image from repeating itself, set the
background-repeat
property to no-repeat
.Example
<style>
body {
background-image: url('example_img_girl.jpg');
background-repeat: no-repeat;
}
</style>
Try it Yourself »body {
background-image: url('example_img_girl.jpg');
background-repeat: no-repeat;
}
</style>
Background Cover
If you want the background image to cover the entire element, you can set the
background-size
property to cover.
Also, to make sure the entire element is always covered, set the
background-attachment
property to fixed:
This way, the background image will cover the entire element, with no stretching (the image will keep its original proportions):
Example
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
</style>
Try it Yourself »body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
</style>
Background Stretch
If you want the background image to stretch to fit the entire element, you can set the
background-size
property to 100% 100%
: Html Image Code Generator
Try resizing the browser window, and you will see that the image will stretch, but always cover the entire element.
Example
<style>
body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
</style>
Try it Yourself »body {
background-image: url('img_girl.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 100% 100%;
}
</style>
Learn More CSS
From the examples above you have learned that background images can be styled by using the CSS background properties.
To learn more about CSS background properties, study our CSS Background Tutorial.
Advertisement
Quick online tool to convert your image to HTML file. Supports jpg, png, webp, bmp and svg image formats. Just drop your image in tool and click convert to html button to write image as html file. Download button is enabled, after image is converted to HTML file.
Free Html Code Generator
Image to HTML converter tool encodes image to its base64 string and append it in img tag as src. All these process are carried out using web browser, so the conversion process is simple, fast and more secure. Once process completed HTML script is displayed in tool to copy.
![Picture Picture](/uploads/1/2/6/4/126425554/159566511.jpg)
Image to HTML converter tool is completely free to use and it is a full version, no hidden payments, no signup required, no demo versions and no other limitations.You can convert any number of images to HTML file.
No additional skills are required to convert image to HTML file, using this tool. Drop your image in tool and click convert to HTML button to process. Once completed, copy your HTML script displayed in tool.
Yes images are highly secured. We are doing the conversion process in web browser and we are not upload your images to server or any where else. So images are secured and is not moved anywhere away from your computer.
Online Html Image Code Generator
There is no restrictions to use this tool, you can convert any number of images to HTML script. No login, no signup and no other limitations to use this tool.