CodeIgniter Forums
inline css - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forum-1.html)
+--- Forum: Lounge (https://forum.codeigniter.com/forum-3.html)
+--- Thread: inline css (/thread-71677.html)



inline css - ignitedcms - 09-12-2018

Hi Guys,

What do you think of inline css, is it a terrible idea. Do you create classes on the fly, do you organise your css files so they nicely follow a flow and read logically.

At the moment I kinda just add my css styles ad hoc. I know this is not good practice. So how do go about doing this?

Do you plan the css first from the onset?


RE: inline css - Pertti - 09-12-2018

My front-end focused mate was saying something about new trend where CSS is broken into two - above the fold required stuff and rest. If above the fold was less than 60Kb I think, he said the best practice was to load it as part of HTML.

As for element based inline styling, it's not necessarily bad in all cases, but most of the time you might be better off using CSS classes or utility classes, and somehow make it easily customisable, so you can easily and quickly reuse same definitions.


RE: inline css - ignitedcms - 09-12-2018

(09-12-2018, 12:20 PM)Pertti Wrote: My front-end focused mate was saying something about new trend where CSS is broken into two - above the fold required stuff and rest. If above the fold was less than 60Kb I think, he said the best practice was to load it as part of HTML.

As for element based inline styling, it's not necessarily bad in all cases, but most of the time you might be better off using CSS classes or utility classes, and somehow make it easily customisable, so you can easily and quickly reuse same definitions.

Yes I think you're right, admittedly I've always been lacking when it comes to proper html and css practices so this is something I want to approve upon.


RE: inline css - InsiteFX - 09-12-2018

I find it best to to create css files that pertain to what they are for.

footer
page
content
etc;

Then merge them together all into one file for faster loading, this way you
can modify just the one that you need.

Inline css is best used for email templates.


RE: inline css - php_rocs - 09-13-2018

@ignitedcms,

I'm not a fan of inline css (although there are exceptions). I'm a fan of the suggestion that InsiteFX made.