CS202 GDB1 Solution and discussion
Suppose you are working as a web designer and you have developed a website for some client. Your supervisor is concerned with layout of your website. He has conducted a meeting with you to correct issues related to layout of website, so you have to quickly respond to his requirements and change the website layout quickly. After making quick changes, you have to consider the factor of maintainability too. You have been given two options, CSS Inline styling and external styling to style your web pages. So, by considering quick response and maintainability factors, which option you will use for above scenario? Justify your answer with solid points.
Imagine if your css is in inline styles through a 1000 pages of your site. How an earth can you respond quickly as you would need to change all 1000 pages. With an external stylesheet the changes can be made in seconds and the css is cached for the whole site unlike inline styling.
Inline styling is mainly used these days for above the fold rendering on speed critical sites but used very sparingly. Most websites do not need this type of structure if coded correctly in the first place.
Avoid inline styling at all costs unless you have a justified use case as mentioned above or perhaps for dynamic styling with js for some special effects.
In general stylesheets should be external.
moaaz last edited by
External styling all the way. Inline styling may be “quicker” in the short run, but over time, it’s going to be a nightmare to maintain, and the chances of inconsistency grows exponentially…