Jump to content

Overlapping images?


Roy766

Recommended Posts

Hi all!

 

Sorry if this is in the wrong section, but I'm not really sure if this would relate to PHP, CSS, JS, or just basic HTML.

 

Just one basic question: I want to have a sort of background image, and then put smaller images on top of it. Think of it sort of like a game: where I have a map and some sprites on top of them.

 

Sorry for the really stupid question, but I really have no idea how to do this  :-\

Link to comment
Share on other sites

this could be done with css and html. Here is how

 

<div id="backgroundImage">

   <div id="smallImage"> 

        <img src="Path to your image" width="size here" height="size here" />

   </div><!--end smallImage div-->

</div<!--end backgroundImage div -->

    

 

so you would need to make an html file and the css file linked like this

 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<head>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<title></title>

</head>

<body>

<div id="backgroundImage">

   <div id="smallImage"> 

        <img src="servlet.jpeg" width="100" height="158" />

   </div><!--end smallImage div-->

</div<!--end backgroundImage div -->


</body>
</html>

 

then make a file named stylesheet.css and drop the css code into that file and put it in the same location as the html file

 

#backgroundImage {  position: relative; width: 400px; height: 400px; background:url(YOUR IMAGE HERE.jpg) repeat; }
#smallImage { position: absolute; top: 30px; left: 60px;} /* CHANGE TOP AND LEFT TO WHAT YOU NEED */

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.