Modify CSS on the fly

G

Guadala Harry

I once saw an online css tutorial (sorry I don't remember the URL - it was
so long ago) that had a demo page that was split into two sections: on the
left side, one could specify the css to be applied (e.g, font size, font
color) and then click a button. When the user clicked the button, some
generic text in a small box on the right side of the page would get updated
to show the effects of whatever css settings the user had entered on the
left side of the page.

I'm wondering how to implement this sort of thing; modifying the CSS that is
applied to a page at runtime (where the css is specified in a
separate/attached .css file - not inline css). Must the the file be
overwritten and then the page reloaded? or can it be simpler than that?

Thanks.
 
M

Mike Bridge

You could do this without reloading with JavaScript, e.g.:

http://www.blackbyrd.ca/

Or if you want to do it in asp.net, you could use an
HtmlGenericControl to access a <LINK runat="server" .../> tag, and
change the url of the css file.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top