HTML and CSS Reference
In-Depth Information
comments. There is no one right way to format and organize CSS code, but
this section will provide some place to start as you learn CSS and build
and test your code.
Code Locations
CSS has its greatest value when it's shared across multiple documents
or entire sites rather than rewritten or copy and pasted from document
to document. As a result, it is common to break style rules into groups of
how they apply to your content:
Global styles : This includes style information that can be applied to the
entire site. These styles should be in one of the first linked external CSS
documents.
Section or page type styles : This includes style information that can be
applied to a subsection or alternate page type augmenting or chang-
ing the global styles. These styles can be in a separate external style
sheet linked after the global CSS document only from that type of
page, or included in the global CSS document with some class or id
used on an HTML element such as <body> to distinguish the page type.
Page or content-specific styles : This includes style information that is
shared among pages infrequently or not at all. If it is a small amount
of code, it can be placed in either the global or section CSS documents;
however, if more extensive, a third linked document may be used.
Unique documents : It may be that a page type on a site is truly unique
or that a document is intended to not be part of a site or set of other
documents. This is the case with the code used to generate the figures
throughout this topic. In these cases, a style block can cut down the
number of external files that need managing or requests being made
to the server.
 
Search WWH ::




Custom Search