How to dynamically reload a .css?


Tags: html,css,asp.net-mvc-3

Problem :

I have a website that I would like to present different styles for evaluation by having users click on a link(s) where an according proposed style gets loaded. How can I dynamically reload .css files?



Solution :

Using javascript you should be able to manipulate the css elements (such as document.createElement("style"); and then filling it with what you need and appending it to the page. Replacing that element will change the css that the page is styled with. However, if you are trying to switch between linked .css files, it may not work dynamically because it could require a page refresh.


    CSS Howto..

    How to vertically align images inside a list

    How does Outlook.com have the title text underlined?

    How can I achieve float left at bottom and float right at top with css flexbox?

    CSS - How to use by ID and by class

    With CSS, how would I align this banner and navigation menu to XHTML 1.0 Strict specifications?

    how do i hide anchor text without hiding the anchor

    How to set background color with opacity by css?

    Google Font API uses browser detection. How to get all font variations for font-face

    How to FadeIn a parent element and then it's child elements with a slight Delay (CSS Only)

    Google Chrome Package Apps : How to make transparent rounded background like google hangout app?

    how to make those two divs in one line

    How can I make my jquery mobile collapsible set larger using css

    How to close the menu after click third layer menu item

    CSS: how to position buttons in groups across a row on a web page

    How to right align a flipswitch in jquery mobile 1.4.5

    CSS Nav Menu Text rare behaviour in size thats aligned bottom some how

    How to use images for check boxes using CSS or may be Javascript?

    How to use css animate correctly?

    How are table cell widths calculated in html?

    How to create a similar background to this one

    Showing and hiding content

    How can I push the first row of images down?

    How to do Hanging Punctuation in HTML / CSS

    How to have an image overlap the edge of a div

    Getting the title of a picture overlayed onto the picture of a slideshow

    How to remove all CSS property inside a class, but don't remove class using jQuery

    How to use these ruby based CSS stylsheet frameworks languages?

    How to show a background image over foreground image using CSS

    How to stretch text in CSS like microsoft word?

    how to make background image stretch vertically