5 replies [Last post]
maxplanck735
Offline
Enthusiast
Last seen: 12 years 33 weeks ago
Joined: 2007-02-23
Posts: 66
Points: 0

I'm trying to position an image using a Stylesheet and an ID. But it doesn't work! I've positioned many Divs this way and it's worked fine. But not images! What am I doing wrong?

Here's the HTML:
metronome.png

And here's the CSS from the Stylesheet:
#para {position: relative;
top: 35px;}

I tried putting the CSS directly into the image tag, and THAT works. But I want to use a stylesheet. Here's the code that works:
metronome.png

Thanks, any help is much appreciated

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 49 weeks 11 hours ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

You should try to avoid

You should try to avoid absolute positioning as much as possible. It leads to all sorts of complications and trouble.

The IMG tag is an inline element and will behave differently than the P element which is block. Give the image in question the rule "display:block;" and see if that helps ny.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

maxplanck735
Offline
Enthusiast
Last seen: 12 years 33 weeks ago
Joined: 2007-02-23
Posts: 66
Points: 0

didn't help

didn't help

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 49 weeks 11 hours ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Well if you want really

Well if you want really useful help around here you need to post all your code, not just snippets, and even better than that would be a link to the page that shows the problems.

Time after time we find that the real problem is nowhere near what the poster thinks to be the "relevant" part of the code. Are you using a proper doctype and is both your CSS and your html fully validated against the W3C validators? Invalid code can make things mess up in amazingly strange ways.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

maxplanck735
Offline
Enthusiast
Last seen: 12 years 33 weeks ago
Joined: 2007-02-23
Posts: 66
Points: 0

In the process of making the

In the process of making the changes required for complete validation, the problem was fixed. I should follow the site rules next time!! :bigoops:

Thanks for helping me out!

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 49 weeks 11 hours ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

well, at least you had the

well, at least you had the sense to follow good advice when it was given! That puts you quite a ways ahead of the average new poster around here, or so it often seems...

Validating a page often has the effect you observed. That's one reason we insist on folks doing it.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.