Jump to content

image over background image


jasonc

Recommended Posts

i have used <div>'s before and thought i'd try this but it did not work

 

<div>

left

</div>

<div>

middle

</div>

<div>

right

</div>

 

what i am wanting to do is have a load of photos on the page i shall be using PHP to do this, but it is the layout that i am having problems with, thats why i am posting here and not in the PHP forum.

 

i attach a jpg of the sort of layout i would like to have.

 

can someone please help me with a simple CSS code that will place an image over a round edged image as a background. as in the jpg.

 

thanks in advance

 

[attachment deleted by admin]

Link to comment
Share on other sites

you need to be using your style sheet

e.g.

<div class="mydiv">

 

your css file should be something like;

.mydiv
        {
width:300px;
background-image:url(/background.jpg);
margin:5px;
position:relative;
float:left;
}

 

Is that the sort of thing you are looking for?

Link to comment
Share on other sites

If your sizes of the containing divs are always going to be fixed, a simple background image declaration is all that is needed:

 

CSS:

div.holder {
  background: url('your-background-image.jpg') no-repeat 50% 50%; /* centered in the background */
  text-align: center;
}

 

HTML:

<div class="holder">
  <img src="my-image.jpg" />
  <p>My Text</p>
</div>

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.