Skip to content
WJunction - Webmaster Forum

<img> background

Status
Not open for further replies.

Jayar

Experienced Member
629
2009
15
Hey guys,

I was wondering if theres some way I could get something like this to serve as a background layer:

Code:
//background layer
<div>
<img src="backgroundimg.png"/>
</div>

//layers above it
<div>etc</div><div>more</div>

I have an idea of I could make this work, but my method would be sort of unorthodox I think, and probably be glitchy.

Thanks for your help
 

4 comments

That's not the correct way to do it.
PHP:
<div class="bitches">
	<div class="whore">
		<p>Example of Something here</p>
	</div>
</div>

And then you have a CSS File
PHP:
.bitches {
	background:#abcdef url(images/bg.png);
	etc etc.
}
.whore {
	color:#12345;
	padding:10px;
	margin:20px;
	etc etc.
}
 
I know that I can do it that way, but I want to specifically use a <img tag instead of css :l
 
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
   <style type="text/css">
       .bottomDiv {
       // u can use z-index: 0; and same assign below to 1
       }
       .topDiv {
           position: absolute;
           top:10px;
           left:20px;
           width:200px;
           height:25px;
           // z-index: 1; 
       }
   </style>
</head>
<body>
<div class="bottomDiv">
 <img src="http://freaktools.com/images/logo.png" alt="">
</div>
 <div class="topDiv">Here comes your content</div>
</body>
</html>

you can also use z-index as well.

Edit: Plz change your avatar its so annoying, thank you
 
Last edited:
Status
Not open for further replies.

About the author

J
Experienced Member · Joined
Life sucks. Then you die. web design, movies, friends, music.
629
Messages
15
Reactions
18
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom