HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 10th, 2004, 12:17 PM
rblanda rblanda is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 1 rblanda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Resize fonts with browser resolution?

Hi, Everyone,

Here's a doozie for ya. Im very well versed in web deveopment - been designing for years. Client of mine comes to me and asks me to build a site. One problem: he wants the pages - when resized - to resize with the browser. No problem, right? Create some 100% table widths in, set the image sizes to, lets say 60%, throw in the align=right on the images. Ok? Done.

Not yet. He wants the actual fonts to increase in size as the browser does. For instance, 640x480 users might see the font as 12px, but 1280 by 1024 users see the font size as, lets say, 16px. Now I know this can be done, but I don't know how. (when you export a powerpoint presentation, it does it using that funky css/xml combo.)

Any help? I want to take the job, but want to make sure I can do this.

Reply With Quote
  #2  
Old January 10th, 2004, 08:04 PM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
strange but not difficult. Using javascript to detect screen.height and screen.width, depending on these for resolution, you dynamically use a different CSS.

Pseudocode is...

If screen width is less than or equal to 800 then document.write ('<LINK REL="stylesheet" HREF="/800x600.css" TYPE="text/css">');

Else if width is less than 1024 and greater than 800 then
document.write ('<LINK REL="stylesheet" HREF="/1024x768.css" TYPE="text/css">');
Else
document.write ('<LINK REL="stylesheet" HREF="/over1024.css" TYPE="text/css">');

Use javascript to allow yourself to dynamically write whatever CSS script you want.

You'll need a body tag like this so that if the user resizes the screen the appropriate CSS will be written:
<body onresize="javascript:location.reload();">

ALTERNATIVELY....

Do it in Flash. You can set parameters for height and width which will scale the site to the browser size. It's a PAIN to keep a flash site up to date if you don't know how to integrate Flash and databases or dynamic text. I'd try to the first option.

Take the job.

Reply With Quote
  #3  
Old January 10th, 2004, 08:08 PM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
Here is something that may stink but i don't think there's a way around this... if someone is filling out a form on this site and just happen to resize the window (not knowing about your potential client's desires) then when the screen refreshes the form will be cleared which may annoy people. Also make sure that the site is not graphic heavy or else a dial-up user who waits 2 minutes for the site to load will have to wait another 2 minutes if they resize the screen. that's not fair.

Just remember, your job is to do wahtever your client wants, not to help him/her decide how to make the site user-friendly... unless he/she ASKS for your input.

Reply With Quote
  #4  
Old January 10th, 2004, 08:13 PM
shamrog12's Avatar
shamrog12 shamrog12 is offline
Newton's Apple Wizard
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 1,661 shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level)shamrog12 User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Weeks 2 Days 2 h 39 m 22 sec
Reputation Power: 34
Send a message via AIM to shamrog12
if you do not want to change the CSS depending on the size of the browser window and you want to control the CSS strictly based upon POTENTIAL or AVAILABLE screen width then you would use Javasscript's window.screen.availWidth to detect if they have 640, 800,1024,1280, or higher and then the document.write depending on that.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Resize fonts with browser resolution?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway