Solved

Force image to top of screen

Posted on 2011-03-20
6
363 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

827 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