Home Forums General Issues Avoiding Inline Styles Reply To: Avoiding Inline Styles

  • The alternative is to create a list of classes for every style you want to provide and output them all into the class and then create a css rule for every one of those classes. Of course this means that you’re going to spend a lot more time coding and keeping all those things straight and every time you change one thing you need to change several others.

    On the other hand, the main reason for separation in my opinion is to allow changes by other developers to be made more quickly in the future. Separation in this case will only make that job more difficult.

    Since the goal of your admin interface is to allow the user to set the styles of individual elements then I personally don’t see any reason why you shouldn’t just output those styles. This will also allow for faster changes in the future. If for example you want to allow a new color or font you just need to add it to what can be selected by the user and you’re done.

    This to me is no different than allowing the editor to apply colors, fonts, sizes and any number of other formatting options in the WP content editor.

    Sometimes it’s better not to over complicate things by insisting on doing what is considered “best practice” by the masses.