Reputation: 99
I would like to create a website that would allow the client to log in to an admin page which would allow them to customize their site, such as their site's background color etc. Is there is a way to permanently change the CSS of the UI of the website without directly accessing the CSS file? Essentially allowing a non-programmer to customize their own styles.
Upvotes: 0
Views: 75
Reputation: 796
If you're doing a custom development, let's say you want to customize things like: font size, UI colors, page width, etc... the way to go would be something like:
#header { background-color: #000 }
(let's say that user selected black).<style>
tag at the <head>
, or using a separate stylesheet (which I'd recommend, for good practices sake), if you do a separate stylesheet, you'll have to write the file at the filesystem, and be sure of: custom stylesheet loads after the site stylesheet (or write all styles with greater specificity).That way you're not modifying permanently the site stylesheet, but adding an additional style layer which will override the default styling.
Now, if you want to go on deep waters, I'd recommend to work with sass... you could set a on-server sass compiling environment, and, when user selects modifications, you just modify the variables on the sass, and re-generate the CSS which will be loaded at the site.
Hope this helps.
Upvotes: 1