General Question

Evan's avatar

Does anyone know how to align an image at the ACTUAL top of a page?

Asked by Evan (805points) July 5th, 2007

I'm trying to get an image to align at the actual top/left of the page, w/o the gap.. that has to be possible, right? Does anyone know how to make that happen?

Observing members: 0 Composing members: 0

6 Answers

ben's avatar

Have you tried (css rule) { position: absolute; top: 0px; left: 0px; } ?
To give you a definitive answer, I'd need to see your current source. (There are a number of ways to do this, but it depends how you've set up your code).
Can you clarify "actual"? if you're scrolled down a long page, do you want it out of view, or fixed at the top of the viewport?

Vincentt's avatar

In the CSS,

body{
margin: 0;
}

I know, it's weird, body should not have a margin as it's the outer width of the page, but that's life :P

You might have to set the body's padding to 0 too. And of course the margin of the image, but I suppose that's default.

Hope that helps.

Evan's avatar

@ Ben - that'll help - i hadn't thought of CSSing it, but it'll work perfectly i think. that should make it easier.

@ Vincentt - also thanks. I was concerned about the image, and I'll still need to due that, but i think my initial issue actually was the margin issues. but it worked great, so thnx!

Lot9's avatar

For me, this css code is a mainstay. I always start every sheet with this code:

* {
margin: 0;
padding: 0;
border: 0;
}

It disables all the margin and padding issues that I have. It also allows me to put anything on any page without contending with IE or having to create some sort of hack to compensate.

Vincentt's avatar

Lot9, I did that too, but then I though: "wait, IE6 didn't support * did it?". It doesn't, right? That's why the holly hack works.

Response moderated

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther