473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Position fixed image different screen resolution

170 100+
Hi,

I have a 314 x 190 png which I want displayed basically halfway between the end of some form fields and the side of the #wrapper. So I put it in a div
Expand|Select|Wrap|Line Numbers
  1. <div style='position:absolute;left:45%;top:50%;'>
  2. <img src=images/front1.png border=0>
  3. </div>
which looks great on res 1280 x 1024, 1200 x 800, 1200 x 768, 1152 x 864

It's pushed to the right on 1024 x 768 and 800 x 600
It's pushed way left on 1600 x 1200

Two questions:
1) Which screen res are the important ones to get right?
2) I thought % would take care of the problem but I clearly don't uinderstand css enough. What do I need to change to have the image stay in the same position?

Many thanks for any answers
Jun 21 '09 #1
5 15674
drhowarddrfine
7,435 Expert 4TB
Get a quicker answer
Jun 21 '09 #2
Skeer
6
Try putting the div outside of any parent with restricted widths then adding "margin: auto auto;" Which makes the div have auto left and right margins. In other words, centered. Try removing the right and left positions and play around with the "position" style. Make sure the div width is set to image width.
Jun 21 '09 #3
beary
170 100+
@drhowarddrfine
Skeer, thanks heaps for your answer. It gives me something to try. It hasn't totally solved it, but it gives me something to go on. Much appreciated.

Drhowardfine, taking into account your 5,197 posts and the fact that you're designated an expert, your answer didn't help. I posted code. And I'm fairly sure that the answer to my 1st question (take another look) is not found on the page you linked to. Honestly, I appreciate the fact that you've made a lot of posts, but would it be possible to try and provide "answers"? (And please don't flame me, this is a genuine request.)
Jun 22 '09 #4
drhowarddrfine
7,435 Expert 4TB
@beary
And former moderator of this forum.
your answer didn't help. I posted code.
Reread the link I sent you. My first line is "I see these mistakes over and over again." and I'm seeing it again. That's why I created that post and it's been stickied there for years.
would it be possible to try and provide "answers"? (And please don't flame me, this is a genuine request.)
You'll get answers when you provide proper information. Again, reread the link I gave you. That's why it's titled "How to get a quicker and more complete answer." The information you give is not enough to answer the question. We can pass the ball back and forth for quite a while and still wind up with what you did with Skeer:
It hasn't totally solved it
If I'm going to take time to help solve your problem, I don't want to waste it going off in one direction only to find out you didn't have a doctype and that would solve everything with no effort.

The answer to your first question is....there is none. Pick one and someone will argue another, but THAT is not your problem. The problem is you can't get your image in the right place in different resolutions. Fixing that problem maybe makes the first question moot.

So, I provided you with a way to get a quicker better answer by giving more and better information with little to no guess work or minimal back and forth. If you want a lot of back and forth and guessing spread over several days, I'm sure Skeer will help you with that.
Jun 22 '09 #5
beary
170 100+
@drhowarddrfine
Well I would've included that if I'd known! :)
More stuff you wrote
Fair enough. I see your points.

Actually, I was wrong: Skeer's efforts did solve the problem. I realised the containing div wasn't positioned relative and with his suggestion to margin:auto auto, it stays exactly where it should now in every resolution I can test.

But I completely take your point, as a post of the html and css would have shown you I was missing the position:relative.

The answer to your first question is....there is none.
Thankyou.

Fixing that problem maybe makes the first question moot.
Point taken...

So, I provided you with a way to get a quicker better answer by giving more and better information with little to no guess work or minimal back and forth. If you want a lot of back and forth and guessing spread over several days, I'm sure Skeer will help you with that.
Yeah I reckon he would as well :)

Thanks for your further explanations (sincerely). Case closed I think.
Jun 22 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: tim | last post by:
can someone tell me which function returns the screen resolution in java script?
5
by: Maxi | last post by:
I have a 30X16 cells table in my html page. Table height and width are set to 100%. I have set size of every cell inside the table to 24 pixel. When I open the html page in maximize state in...
6
by: Sandy Pittendrigh | last post by:
I have a fishing related site with a billion photos, where 600 pixels as a maximum photo width looks OK at both low resolution and high resolution, but spectacular in neither. Browser stats sites...
4
by: pedestrian via DotNetMonster.com | last post by:
I'm creating WinForm app. I would like to set the form position according to current Screen resolution. So how could I find the current resolution? Thanks... -- Message posted via...
35
by: Friendly_Lola | last post by:
What Screen Resolution do You use? 800 X 600 1024 X 768 1280 X 1024 Wow! 1600 X 1200 (i can't imagine this) I use 1024 X 768. For what resolution you optimize your web pages?
7
by: Norman Swartz | last post by:
I want to place some graphic images on the web that are optimally viewed at a resolution of 1024 by 768 pixels. Is it possible, within Javascript,to force a particular screen resolution?
0
Shashi Sadasivan
by: Shashi Sadasivan | last post by:
Hi All, I will start working on a form soon which runs as an mdi container (in the main screen) However there is this "new" requirement, there will be 4 screens, and one of the features of the...
23
by: salmobytes | last post by:
I try to do all css with percents and ems (elastic/liquid) so my displays look as much the same as possible, regardless the user's screen resolution. But I (still) never seem to get what I want. ...
6
mikek12004
by: mikek12004 | last post by:
I want to load a different swf in PHP based on the viewer's screen resolution. All would be fine if I could get the screen resolution in a variable in PHP. Problem is that after I done a bit of a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.