Solved

Force image to top of screen

Posted on 2011-03-20
6
349 Views
Last Modified: 2012-05-11
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
Comment
Question by:SweatCoder
6 Comments
 
LVL 3

Expert Comment

by:brdavs
ID: 35176489
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
 
LVL 20

Expert Comment

by:Mark Brady
ID: 35177411
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
 
LVL 30

Expert Comment

by:LZ1
ID: 35180885
Can you please post a live URL?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 11

Author Comment

by:SweatCoder
ID: 35194574
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
 
LVL 3

Accepted Solution

by:
brdavs earned 500 total points
ID: 35202930
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
 
LVL 11

Author Closing Comment

by:SweatCoder
ID: 35203539
Thanks brdavs! That works great.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now