Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums

Go Back   Code Forums > Application and Web Development > HTML, XML, Javascript, AJAX

Reply
 
LinkBack Thread Tools Display Modes
Old 04-19-2006, 12:52 AM   #1 (permalink)
j.gohel
Code Monkey
 
Join Date: Apr 2005
Posts: 68
j.gohel is on a distinguished road
Making web pages independent of the screen resolution??

Hi,

In my web application i have arranged some elements (like image) using CSS position property: absolute value.

But when i am accessing the application from the web where the resolution of the screen is not same as of my screen there the components get displayed at different positions.


I have the following code in which my textbox & image is to be set side by side & it should remain in that position only if the resolution of the screen gets changed???



HTML Code:
<HTML>
<HEAD>
<TITLE>Float example</TITLE>
<STYLE type="text/css">    
      IMG { float: right } 
</STYLE> 
 </HEAD>

 <BODY>	
  <table>	
 	<tr>			
                    <td>Name:</td>			 
                    <td><input type=  "text" >
  	 <IMG src="hsbc_logo.gif" alt="This image will illustrate floats">	  </td>
	</tr>
  </table>
</BODY>
</HTML>
Thanks,
Jignesh
j.gohel is offline   Reply With Quote
Old 04-19-2006, 03:19 AM   #2 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
I think you uploaded the wrong code. In general, absolute postioning treats the browser window as a pixel addressable canvas and let's you stick things to it. Usually with webpages relative postioning is more helpful, since you can maintain the hierarchy and such. Absolute positioning suffers from the same problems as using pixel values for font sizes. Namely, fonts can become illegible on monitors with denser resolutions.

Also as cool as CSS is, sometimes it's just better to use a table to position local elements, and use CSS to tie together the site as a whole.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 04-20-2006, 09:04 PM   #3 (permalink)
j.gohel
Code Monkey
 
Join Date: Apr 2005
Posts: 68
j.gohel is on a distinguished road
Hi,
Thanks for the reply.
But i didn't get you clearly what you mean to say.
If not absolute postioning then what should i use??

Jignesh
j.gohel is offline   Reply With Quote
Old 04-21-2006, 07:54 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
your code does not use absolute positioning anywhere. what you should use depends on the layout you are trying to design.

maybe it would be more effective if you posted a screen shot of what you are trying to accomplish.

without an idea of the page layout, no one is going to be able to give you advice for your problem.
sde is offline   Reply With Quote
Old 04-21-2006, 08:24 AM   #5 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
You must use 'em' and percentual placements.

use em for correct sizing based on the user prefered text size.
Code:
td {
    height: 1em;
}
precentual placement
Code:
div {
  left: 40%;
  width: 20%;
}
or
Code:
div {
  float: left;
  margin-left: 20%;
}
example: http://dragonflycms.com/
DJMaze is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 06:33 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting