Why External CSS is Important for Designing a Webpage????

Discussion in 'CSS' started by Balraj Grewal, Jul 17, 2014.

  1. #1
    Can Any1 Tell ????
     
    Balraj Grewal, Jul 17, 2014 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #2
    1) Caching. IF you have CSS that's common to multiple pages, it is cached when users visit your sub-pages; aka it's not downloaded again because the browser just downloaded it. This saves bandwidth and makes sub-pages load faster.

    2) Pre-caching. If you have CSS for subpages loaded ahead of time, that caching above pre-caches appearance, making sub-pages load even FASTER.

    3) Media targets. Your HTML should say what things ARE, NOT what they look like. This way you can customize the appearance to any number of different targets -- print, screen, handheld. This now includes responsive layout -- which should be common to all your pages, not just the one.

    4) Themes -- if you have semantic markup, external CSS makes it easy to reskin the entire page without touching the markup -- or even have multiple appearances on the same site visitors can choose between. It just makes it easier to do that.

    3+4 combine as to why the STYLE attribute is in all but the rarest of cases just as stupid as using presentational markup.

    5) Ease of editing. I laugh at the people who put together monolithic HTML, where they use the STYLE tag and STYLE attribute all over the place -- even in testing -- as how is that any easier to work with. If you have a GOOD editor where you can edit files in different windows, it's far easier to have the HTML in one window, the style in another window, to edit them side-by-side than is to bloat out the markup with presentation that has no damned business there, or constantly scrolling up to the head to find the STYLE tag and then scrolling down to BODY... assuming of course one realizes that the STYLE tag is invalid inside BODY in the first place, which sadly a LOT of people sleazing out HTML any-old-way are completely ignorant of :(

    6) Faster execution in server-side processing. If you have split up your markup into a CMS the more code you have the PHP, ASP or what-have-you trying to output, the harder it has to work. Smaller HTML output == less back end processing, so getting static unchanging values into a static file the server can just send without processing results in cleaner, faster executing code.

    7) Ability to offload to another server. CDN's, subdomains, lightweight static content servers -- you can move static files like CSS and JS to another server, something you can't do if it's in the markup!

    8) Easier back-end coding. What's easier, trying to manage five or six semantic tags, or twenty lines of presentational nonsense? Less markup == less back end code == easier to maintain!

    Pretty much if your website has more than one page, or frequent visits from the same users, moving ANYTHING you can out of the markup will pay off benefits in speed and bandwidth, and be ready for more complex bandwidth and processing saving techniques. It's why IMHO the STYLE tag should be removed from the HTML specification entirely, and the STYLE attribute should only be used in the rarest of cases where something like width or font-size can be used to convey meaning (like on a bar graph) since again, your HTML should say what things ARE and convey MEANING, and is NOT for saying what things look like. If you choose your markup based on your desired appearance, you are likely choosing all the wrong tags for all the wrong reasons!
     
    deathshadow, Jul 18, 2014 IP
  3. salman safder

    salman safder Well-Known Member

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    111
    #3
    for multiple reasons, if you need to change something later on categorically it is easy to do that then, anything u can do change accordingly without trouble, u give one command it will change all easily but in internal u need to do it all pages manually and that is troublesome.
     
    salman safder, Jul 31, 2014 IP
  4. alfieindesigns

    alfieindesigns Well-Known Member

    Messages:
    128
    Likes Received:
    5
    Best Answers:
    2
    Trophy Points:
    130
    #4
    Great! Well explained by @deathshadow

    For my comment. It's a must.
    And because of the ff:
    1. Efficient in production
    2. Semantic coding
    3. I can say, it should be a standard.

    Thanks everyone. God bless always!
     
    alfieindesigns, Aug 27, 2014 IP