How to change the CSS of entire page/website on click?

Tags: javascript,html,css,stylesheet

Problem :

Is it possible to have 3-4 CSS on a page, and then on any event, say click, change the css for entire webpage. This way we can give our user the ability to change the theme. I know we can change the css of an element by:


Solution :

Yes, it is possible. Typically what you would do is write a JavaScript function that will change, or add, or remove a style sheet from the <head> of the document. To make the experience a little better you'll typically store the user's preference in a cookie. There's an article on A List Apart that show how to implement this.

And of course, you can do this with jQuery... you may want to check out the source of jStyler.

    CSS Howto..

    How to find absolute path to @font-face fonts with Firebug?

    How can I split a text in 2 color vertically?

    How to change header size in css

    How to create a lightbox like this [closed]

    How to align a background image to bottom of table cells in css?

    How to make div expand all the way to the right

    How to use opacity when not use rgba color in css?

    How to wrap a vertical overflow horizontally in css?

    How to create a header.php and footer.php with CSS files?

    How to alternate rowcolor in a GridView using pure CSS?

    JavaScript and SEO. How Should I reconcile them?

    .How to create fluid layout with css, such that it works on all devices and also on Landscape and Portrait Mode [closed]

    Need help determining how to position this element with CSS

    how change css href to all .html documents with button click?

    How to format XML file with CSS?

    How to neutralize CSS definitions without overriding

    How to call a image class on a regular interval

    how to css absolute positioning right way

    How are CSS properties implemented by different browsers? [closed]

    How to add a custom css selector to just a span??

    How to achieve Expand collapse Side Nav with icon using jquery and boostrap css

    How to place a button in the middle of the page using HTML and CSS

    How to click and swap a text in a button?

    How to override css-setting for the elements of nested table?

    How to differentiate between two class of same name in different css on same page

    How do I add a hover to this css class for a tr?

    How to understand this CSS Menu Demo? [closed]

    How to remove spacing between the top of a border and a div [closed]

    How to define multiple CSS attributes in JQuery?

    Fuelux, how to fix the width of a repeater column