Skip to content
How do i put an image as a backround in html
Profile icon
cmglj

how do i put an image as the backround in html?

@Coder100
by any chance can you tell me if you know? or anyone.

You are viewing a single comment. View All
Profile icon
Whacko

You need to use CSS.

<div class="background"> <!-- Stuff on top of the background goes here. --> </div> <style> .background { background-image: url('theImage.jpg'); height: 100%; background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; } body, html { height: 100%; } </style>

And then INSIDE the div you add what you want.

It should work.

Profile icon
Coder100

@JavaMaster1
why would you add that under the div

Profile icon
Whacko

@Coder100
Oh, wait.

You need to add it inside the div.

Profile icon
Whacko

@Coder100
I updated my post

Profile icon
Coder100

noooo wtf

@JavaMaster1

Profile icon
Whacko

@Coder100
Whats so bad?