HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 38. CH35 CONTENT, PRESENTATION, ACTION 303


Content experts are not always great at style.


Style experts are not always great at content.


Separating form, which is style, from content, is a straight-forward recogni-
tion that we may want to divide the labor of website design among experts,
each of which can specialize in the area they love.


But there is another great reason: reuse. The style that is created for one
page can often be reused on other pages. In fact, your website will look
more cohesive if the style is shared.


And there is another great reason: mass updating. If you decide to change
the style for your website, and if that style is all in one place, shared across
all your webpages, then you only have to change that one place. After you
change your style sheet,allof the pages that use it will be instantly restyled.
(Unless caching temporarily gets in the way.)


38.6 Best Practices: Separation


It is well-established that the best-practice approach is to separate content
from styling.


What that means to you is the HTML of your webpage should include as
little styling as possible. Maybe none. All the styling should be moved
external, to a style sheet.


The downside to this is it requires planning. It requires analysis and think-
ing. It promotes orderly thinking. And at the start of a project, it slows
you down.


So, don’t worry about it. At first. Use in-line or internal style.


While you are developing your webpages, it is okay to put styling right into
the page. That is the “quick and dirty” development process. You can come
back later and migrate it to a style sheet. Just remember to do it.


Do worry about it. Later. (Soon.)


Skilled developers already have a good sense of how to design their style
sheets. They will not resort to quick and dirty techniques nearly so much
as the newbies who lack the depth of experience.

Free download pdf