473,385 Members | 1,470 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,385 software developers and data experts.

Adjust CSS Font Sizes using ASP

Hello, I'm searching for a script that will allow a web user to increase or decrease font sizes on a site using a series of buttons. Right now my fonts are all set to relative em sizes in the style sheet. However, the only scripts I can find for this purpose are style sheet switchers which require you to maintain multiple sheets and save the information in a cookie... and I see this as being tedious over time. any helpful suggestions would be appreciated.
Regards,
Daniel
Jan 9 '08 #1
1 988
Nicodemas
164 Expert 100+
Because you are talking about customizing an appearance for individual users, no matter how you do this, it will be tedious.

Even so, you asked for a solution.

Use global stylesheets and store the user's choice of font-size into a session variable using ASP.

Expand|Select|Wrap|Line Numbers
  1. <%
  2. session("font-size") = user's choice
  3. %>
  4.  
For each page's global style sheet:

Expand|Select|Wrap|Line Numbers
  1. <head>
  2.    <style type="text/css">
  3.       body {font-size: <%= session("font-size") %>;}
  4.    </style>
  5. </head>
You cannot do this with remote CSS files (i.e. <link rel=stylesheet...) because ASP is executed before the file is sent to the user; CSS is rendered by the client. The client cannot interpret ASP code, so you'd end up with this:

Expand|Select|Wrap|Line Numbers
  1. body {font-size: <%= session("font-size") %>
  2.  
... actually being sent to the browser.
Jan 9 '08 #2

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

Similar topics

6
by: Hostile17 | last post by:
What's considered to be the definitive version of a "good font settings" style sheet? That is, one which allows nearly all modern browsers, and Netscape 4, to get readable text. The basis of...
8
by: kchayka | last post by:
<URL:http://www.w3.org/QA/Tips/font-size> In the "recommneded practices", I don't agree with their second bullet point, but the last 2 bullets sound like really bad advice, at least in a WWW...
39
by: David Jubinville | last post by:
Hi All, I've run into a bit of an interesting problem with CSS and font DPI and would certainly welcome help. Problem: Page layout defined in CSS has font size issues (overlapping frames,...
300
by: Ståle Sæbøe | last post by:
I am a bit curious about this. The graphic design people I work with say it is their preferred font for web pages. The reason being that it is "kinder" to the eye both in terms of shape and...
9
by: Dr John Stockton | last post by:
Assuming default set-ups and considering all reasonable browsers, whatever that may mean, what should an author expect that his readers in general will see (with visual browsers) for a page with...
60
by: deko | last post by:
As I understand it, most browser manufacturers have agreed on 16px for their default font size. So, this should be an accurate conversion for percentages: px % 16 = 100 14 = 87.5 13 =...
16
by: maya | last post by:
I have heard so much preaching here about how font sizes should be set as percentages so users can change font-sizes on their browsers... ok, so now at work am working on a site where we need to do...
40
by: Paul Davis | last post by:
Hi all, I'm building some style sheets and trying to play the old game of balancing designer pixel perfection and still allowing users to adjust their font sizes. The compromise I've made with the...
27
by: 1001 Webs | last post by:
I am trying to make my style sheet as compatible as possible and I'm getting a bit confused here. I've read that the best size for font-size would be 76.1%; due to shortcomings in the way both...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.