/    Sign up×
Community /Pin to ProfileBookmark

Image goes ontop of text, instead of underneath text.

Hi, I have the background image in.
then P{ } style in.

But want to add another image underneath the paragraph. The paragraph must go over the image.
But now, the image goes ontop isntead of underneath the paragraph text.

put in img.x{z-index;left:280px;postion:absolute;top;top:400px; width:430px; height:500px;background-image:url(“../spencer/Pictures/girltemp1.png”)}

<img class=”x”;src=”../Pictures/girltemp1.png; alt=”girlfriend1.png”;alt=”girltemp1.png”;id=”girltemp1″>Then the contents</p>

Would anybody know what Im doing wrong.

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@rtretheweySep 13.2012 — To start, your code is full of syntax errors. Don't use semi-colons (';') in your HTML. Semi-colons are used as delimiters in CSS. The rest of your code looks like it's been copied and pasted over and over and jumbled.

Generally, when I want to create this kind of caption/overlay, I create a containing element (usually a <div>) to hold the individual elements so I can control the positioning locally with reference to the containing element.
<i>
</i>&lt;style type="text/css"&gt;
.captionBox { position:relative; top:0; left:0; width:430px; height:500px; z-index:1; }
.captionBox img { position:absolute; top:0; left:0; z-index:1; }
.captionBox p { position:absolute; bottom:0; left:0; z-index:2; }
&lt;/style&gt;
.
.
&lt;/head&gt;
&lt;body&gt;
.
.
&lt;div class="captionBox"&gt;
&lt;img src="../Pictures/girltemp1.png" alt="girltemp1.png" id="girltemp1"&gt;
&lt;p&gt;Then the contents&lt;/p&gt;
&lt;/div&gt;

In the code above, I've set the <div> to position:relative so I can use absolute positioning on the internal elements to position them within the <div>, regardless where I insert that <div> in the page. I set the position of the <img> at the top/left of the <div> with a z-index of 1, and positioned the <p> to the bottom/left with a z-index of 2 so it's shown over the <img>.

That should get you started, but it would be a good idea to read some tutorial on absolute positioning. Good luck!
Copy linkTweet thisAlerts:
@wildguy2authorSep 13.2012 — Hi, thanks alot. Will try that.
×

Success!

Help @wildguy2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...