html - If you have CSS that's specific to that page, is it better to include it in the <head> or a separate file? -
i'm working on web app; 1 of screens requires css that's specific to page (i.e., isn't used anywhere else in app/site).
so - have 3 options:
include in global css file include in page-specific css file include in<head>
of page the downside of alternative 1 css loaded when when user visits screen of app, if never visits specific screen (which quite likely).
the downside of alternative 2 it's separate http request; since css trivially small (<1kb) - seems overhead of http request worse actual bandwidth download data.
the downside of alternative 3 user download css every time visits page (i.e., css won't cached). since infrequently viewed page (and seldomly revisited page), seems minor.
to me - seems alternative 3 might best. read seems discourage approach.
given how hard experts force css sprites minimize http requests, doesn't same logic apply tiny css file? so, why isn't #3 option? there other considerations i've missed?
for it's worth - seems same question applies page-specific javascript; include in <script>
tag @ end of page, or in separate .js file.
thanks in advance.
put in head , move on other problems. :)
"programmers waste enormous amounts of time thinking about, or worrying about, speed of noncritical parts of programs, , these attempts @ efficiency have strong negative impact when debugging , maintenance considered. should forget little efficiencies, 97% of time: premature optimization root of evil. yet should not pass our opportunities in critical 3%." --donald knuth
html css
No comments:
Post a Comment