Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

Force image to top of screen

I have a logo image on my site whose positioning is being affected by 1 or more stylesheets. I need to force this image to be at the very top of the browser window, without affecting the horizontal positioning. I'd like to know how to do this, and maybe play with the vertical positioning so that I can have it a few pixels beneath the top of the window if I need to.

I want to use relative positioning instead of absolute if possible. I'm looking for a simple inline style that will force the image to go to the vertical spot I choose, leaving horizontal alone, relative to either the top of the screen, or to the menus that sit to the right of it.
0
SweatCoder
Asked:
SweatCoder
1 Solution
 
brdavsCommented:
If the image is the first thing that appears on the webpage anyway, just do:
body { margin: 0 0 0 0; padding: 0 0 0 0; }

Open in new window


If you have stuff before it then you have some other options:
1. Set the hight of the stuff to a known value (say 60px) and then set the logo's padding-top to -60px
2. I'd position it absolutely, but just set the top: 0. That way your horizontal position is still floating. The only thing to mind is, that the logo will have no height, so all elements will have to be positioned lower, otherwise they will slip under the logo.

From experinece the second solution is what I would use.

Best regards!
0
 
Mark BradyCommented:
Can you explain how you are putting the image into the page? Is is part of a mysql select statement or is it just placed there manually? Please show us some code and show which image you are talking about. Do you have an online webpage we could view? Guessing would take us forever...
0
 
LZ1Commented:
Can you please post a live URL?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
SweatCoderAuthor Commented:
Sorry for the delay in responding. Here is my site:

http://www.zerogravityprogramming.com/

I've tried messing with the css and I can't seem to move this logo at all. I'd like to just nudge it upward, maybe 10px or something.

Thanks!
0
 
brdavsCommented:
Look at this line here in your CSS:
#topPanel img{width:230px; height:74px; z-index:1; padding:0; position:absolute; margin:0 0 0 1px;}

Open in new window


Fix the top margin to the desired (negative) amount:
#topPanel img{width:230px; height:74px; z-index:1; padding:0; position:absolute; margin:-10px 0 0 1px;}

Open in new window

0
 
SweatCoderAuthor Commented:
Thanks brdavs! That works great.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now