How To Add Image In CSS Background?

Add Image in CSS Background With Div

In previous article I teach you how to add image in html document with simple img tag but in this tutorial you will learn adding image in html document with css.

a simple example image link in html

Download VS Code Editor: Clink here
<img src="xps.jpg" alt="good content writer">

Define the image width and hight

img src="xps.jpg" alt="good content writer" width="1024" height="600">

Adding a image in html  body section.

Step 01: Create sample html page copy following code and past it your index.html

<title>HTML Tutorial</title>

<h1 style=”text-align: center; color: blue;”>HTML BACKGROUND IMAGE</h1>



Add image in CSS Background

Step 02: Add css script in your index.html file in below end the html tag like this.

<style type=”text/css”>
background-image: url(‘xps.jpg’);
background-size: cover;



html add image
html add image

Adding Image In HTML Div  Section

Adding a image in html div section to do this we create one more step in body section.

Step 01: Add <div> tag in the body section

Step 02: Add a class in the div

Step 03: Define a class in the css style



<div class=”bg-img”>



Add image In CSS from folder

<style type=”text/css”>
background-image: url(‘xps.jpg’);

width: 1920px;
height: 700px;


Set The div border

<style type=”text/css”>
background-image: url(‘xps.jpg’);
background-size: cover;
width: 1200px;
height: 500px;
border-radius: 30px;
border: 2px solid;
border-color: blue;
margin-left: 30px;





This Post Has 6 Comments

  1. Marisol Patnode

    I was suggested this web site by my cousin. I’m not sure whether this post is
    written by him as nobody else know such detailed about my trouble.
    You are amazing! Thanks!

  2. Booglymn

    [url=]price of atenolol[/url]

  3. Prince Yahshua images

    Function out and about the purple carpets due to the fact we’ve got one hell of a
    prince rolling into town: Prince Yahshua. When you just
    wish to check out one of your favourite popular sluts receive absolutely wrecked by
    a massive dark-colored pipe, Prince Yahshua
    is the homeboy to get the employment carried
    out. Pale, White-girl ass looks consequently good
    obtaining separate open by a huge merely, dark dick.
    Phat black booties need the duration and girth of a true brother to have drilled
    serious within the thick area of their flourishing ass cheeks.
    Yahshua is in love with all ladies: Asians, Latinas,
    Euro sluts, you label it… he’s sampled
    their delights and dropped a weight on their bodily canvases.
    The Prince seemed to be born in Colorado, but in these days phone calls Chi town his home, possibly because this
    guy’s stuff penetrates thus many that he necessities
    to turn out to be in the property of the Heavy Bowl.

    Yahshua has picked up the Urban A merit for Performer of the
    12 months three periods running, and we’re positive that someday he’t planning to get developing entire trophy rooms.
    Prince Yahshua will be also rather the enterprise guy, since slaying ass and pussy is his organization. That’s why he went ahead and started his unique porn creation enterprise known as Metallic Dark colored Ent Inc.
    This guy is aware how to continue to keep his activity operating at total steam to make sure that all the hottest, virtually
    all delicate porno chicks find the intense cock autos they all therefore
    badly need to have.

  4. Your blog consistently holds my attention from beginning to end. I can’t help but stop reading without consuming every word you write.

  5. all the time i used to read smaller articles that also clear their motive,
    and that is also happening with this article which I am
    reading here.

Leave a Reply