Question: Dear stackoverflowers,

I have a site where I need to give users the ability to change some elements on their user profile page.

Like link color, font, background colors and logo etc.

How would one do this the best way? Create a `TEXT` field in the `user_profiles` table where they may enter their css, and on the profile page do `<style type="text/css">$user->customCss</style>`?

That's like the only thing I can think of but that's really stupid. I only want them to be able to change some elements.

I know one site that does this, reddit.com, there every subreddit has different themes. The mods of subreddits can change pretty much everything I think. How do you think reddit do it?

Answer: 
Don't do it. Consider the different types of users:

1. Non-technical. They probably don't know what CSS is and they're going to break things accidentally. Support nightmare.
2. Technical. These guys might benefit from the option, but even as a developer, for tweaking something like my profile page, **I'd still prefer to use colour pickers and dropdowns**.
3. Smart-ass technical: They're going to try their hardest to break your whole layout, and they will probably succeed. You can do some funky things using just one element.
If you want users to be able to choose themes, I would suggest having custom CSS files for this. Here is the way I do it on my site.

* Create separate CSS files with the styling options you want. In these CSS files it's only necessary to have specific colors, logos, etc. This is in addition to your main CSS file.
* When the user chooses the theme, enter the path/name of it in the database under the users profile.
* When user logs in, store the theme in a session.
* If user changes theme, update the session value.

On the server side (assuming you are using PHP), do something like this.

```
<link rel="stylesheet" type="text/css" href="/css/main.css">
<link rel="stylesheet" type="text/css" href="/css/themes/
<?php echo ($_SESSION["user_theme"]) ? $_SESSION["user_theme"] : 'blue' ?>.css">

```