Solved

Force image to top of screen

Posted on 2011-03-20
6
338 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

746 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

11 Experts available now in Live!

Get 1:1 Help Now