Dynamic stylesheets

Let's add a new feature to our application to allow the user to select a color scheme, or theme, so they can customize the look and feel of the application. We can change the look of a web page by dynamically loading CSS files to override existing styles in our default stylesheet. To implement this, we will add a drop-down list of themes to our application that the user can choose from. When they change the theme, it will change the stylesheet which will change the color of the page.

Get HTML5 Web Application Development By Example Beginner's guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.