Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CSS Align depending on Screen Resolution

Posted on 2013-01-21
8
Medium Priority
?
397 Views
Last Modified: 2013-01-21
Hello All;

This should be a quick one.
The following code is used to align my element, however, the screen resolution differ's for all, so the element is mis-placed depending on on what size the screen is.
How can I adjust, depending on the screen resolution?

<div id="Login" style="display:none; position:absolute; right:200px; top:61px; z-index:100;">
</div>

Open in new window


Thanks All;
Carrzkiss
0
Comment
Question by:Wayne Barron
[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
  • 4
  • 3
8 Comments
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 38801969
Screen resolution is variable so use a variable size measurement instead of px such as em or a specific percentile. em would probably be the best way to go. Then it wouldn't matter what size screen it was it would look the same across them all as it would be relative.
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 38802029
I tried as you suggested, and with the smaller browsers, it is still shifted badly.

<div id="Login" style="display:none; position:absolute; right:12.000em; top:3.305em; z-index:100;">

Open in new window


I am using the following site, to convert over PX to EM
http://pxtoem.com/

Could you provide a good working conversion?
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 38802072
As long as you are absolute positioning on a page that does not have ever single position and dimension fixed, you are going to get a shift.  The only solutions are to either make the whole page rigid and non-responsive, or use scripting to detect resolution and then set the position and that will not work if the user has javascript disabled.

If you post a link to the site we might be able to help further.

Cd&
0
Industry Leaders: 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 31

Author Comment

by:Wayne Barron
ID: 38802104
This is one of the sites that is using it this same technique.
You will see it in the Upper Left, for the Login and Register link.
www.stayinshape.us
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 1500 total points
ID: 38802518
That is a 20th century table layout that is static and rigid. Using a design like that removes any possibility of fluidity or dynamic repositioning.

A different resolution does not do anything except add or remove scrollbars.

The login div is in a table cell and you cannot move a table cell; and you cannot modify it in this case without changing the whole table; and probably other stuff on the page.

Cd&
0
 
LVL 31

Author Comment

by:Wayne Barron
ID: 38802663
Yep, I figured as much.
Having to convert everything over to DIV, at this people, is not an option.
However, in the future it will be.

Thanks for the info Cd&
I will close this one out with your response, as it is about as good as I am going to get at this time.

Also.
Can you provide a good site for demonstrating converting from <table> to <div> layout?

Carrzkiss
0
 
LVL 31

Author Closing Comment

by:Wayne Barron
ID: 38802667
Thanks.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 38802985
It is not so much about converting as it is about looking at it differently.  The basic idea is to make markup and design support content and the meaning of the content (semantic web). The old approach is to develop a design and structure and then make the content fit into the design.  The modern approach is to build structure around the content and present the content as the most important thing, not the design.  

Three other thing come ahead of design. Usability, accessibility, and respect for the user.

Perhaps these links will help you get going in the right direction:

http://coboldinosaur.com/pages/The-Perfect-Page.html
http://www.alistapart.com/
http://net.tutsplus.com/articles/the-abcs-of-web-development/
http://www.cssplay.co.uk/
http://css-tricks.com/

At first it takes a little discipline to force yourself to follow standards and develop a "best practices" approach; but you start seeing the benefit when you have to do maintenance, and it is way easier working with code that was built using modern approaches.  You quickly build a bag of tricks that let's you develop quickly because you know exactly how every element is going to behave.

Cd&
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

721 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