Solved

Force image to top of screen

Posted on 2011-03-20
6
374 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
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…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

752 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