techiebabe
asked on
Changing the font size
I'd like to be able to let the user increase or decrease the font size of a site as they navigate through the site. I need to implement this on both classic asp and .net.
Here's a link to what I'd like to do - http://www.pfizerforliving.com.
If you look over to the right side of the page, the text reads:
Text Size: A A A A
Each time you click on the A, the font size will either increase or decrease. Can someone send me some information as to how I can implement this on my site. I use a stylesheet to change the text on my pages.
Thanks!
Here's a link to what I'd like to do - http://www.pfizerforliving.com.
If you look over to the right side of the page, the text reads:
Text Size: A A A A
Each time you click on the A, the font size will either increase or decrease. Can someone send me some information as to how I can implement this on my site. I use a stylesheet to change the text on my pages.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
stu_pb
I wasn't sure if I had create two style sheets. I was hoping to avoid that, but again, I wasn't sure. Thanks.
I wasn't sure if I had create two style sheets. I was hoping to avoid that, but again, I wasn't sure. Thanks.
You could also try with javascript. This way you will not need to include font sized in your CSS and you can have only one. It may be really slow though, I have never tried anything like this.
function ChangeFont(size)
{
for (var i = 0;i < document.all.length;i++)
{
document.all[i].style.font Size = size;
}
}
You might have to filter out certain types of elements if they don't implement the fontSize property, but most of them should I think.
Good Luck!
function ChangeFont(size)
{
for (var i = 0;i < document.all.length;i++)
{
document.all[i].style.font
}
}
You might have to filter out certain types of elements if they don't implement the fontSize property, but most of them should I think.
Good Luck!
You could use something like this then (so that you need not use 2 stylesheets):
<%
If Session("FontSize") = 5 Then
Response.Write "<style type='css/text'>body{ font-size:5px; }"
Else
Response.Write "<style type='css/text'>body{ font-size:6px; }"
End If
%>
Any CSS code within the HTML document will 'override' the CSS Stylesheet. :)
Regards;
<%
If Session("FontSize") = 5 Then
Response.Write "<style type='css/text'>body{ font-size:5px; }"
Else
Response.Write "<style type='css/text'>body{ font-size:6px; }"
End If
%>
Any CSS code within the HTML document will 'override' the CSS Stylesheet. :)
Regards;
Oops, add an end of script tag: </script> to each response.
dammit. lol. sorry, that should be end of style tag (</style>), so use this:
<%
If Session("FontSize") = 5 Then
Response.Write "<style type='css/text'>body{ font-size:5px; }</style>"
Else
Response.Write "<style type='css/text'>body{ font-size:6px; }</style>""
End If
%>
lol - sorry
<%
If Session("FontSize") = 5 Then
Response.Write "<style type='css/text'>body{ font-size:5px; }</style>"
Else
Response.Write "<style type='css/text'>body{ font-size:6px; }</style>""
End If
%>
lol - sorry
ASKER
InteractiveMind - thanks I think that would definitely work, however, there are differnet font-sizes on the page, it may not work for all.
stu_pb - i think you're right about the js.
Give me a few days to test it out and I will accept the answer I go w/ in a few days. Thanks for your efforts!!!
stu_pb - i think you're right about the js.
Give me a few days to test it out and I will accept the answer I go w/ in a few days. Thanks for your efforts!!!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.w3schools.com/css/pr_font_font-size.asp