12.09.2015 Views

Boot Camp

Web Authoring Boot Camp - StudioBast

Web Authoring Boot Camp - StudioBast

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Styling Code, Part 1<br />

15<br />

Styling Code, Part 1<br />

So far, we’ve been looking at elements, values, and attributes, and sticking with rudimentary<br />

style information. Now we are going to look into the basics of Cascading Styles<br />

(CS). It’s usually referred to as CSS, but technically CSS stands for Cascading Style<br />

Sheets, and if you are not linking external style sheets to your web pages, you aren’t using<br />

CSS. Just the Cascading Styles part of the benefit.<br />

CS is a style language used to describe the presentation semantics (the look and formatting)<br />

of a document written in a markup language – HTML, XHTML, and XML. It is<br />

designed primarily to enable the separation of document content (written in HTML or a<br />

similar markup language) from document presentation, including elements such as the<br />

layout, colors, and fonts. This separation can improve content accessibility, provide more<br />

flexibility and control in the specification of presentation characteristics, and reduce complexity<br />

and repetition in the structural content (such as by allowing for table-less web design).<br />

It is called ‘Cascading’ in reference to Cascading Style Sheets (CSS), where one change<br />

made in a style sheet file can cascade changes in the appearance of that style in all the<br />

web pages linked to it. Also, CSS specifies a priority scheme to determine which style<br />

rules apply if more than one rule matches against a particular element. In this so-called<br />

cascade, priorities or weights are calculated and assigned to rules, so that the results are<br />

predictable.<br />

Cascading styling specifications are different than those used with HTML style attributes<br />

and values (most of which are now deprecated). These specifications are exacting for CS<br />

to work.<br />

You can associate formatting instructions with a web page by defining CS rules in either<br />

an embedded, linked, or inline style sheet. Although there are many ways of defining<br />

styles, the main difference between them is where they are located. CS can be coded in<br />

three ways:<br />

• Inline style rules: Cascading styling is coded inline right in the HTML tags of<br />

web pages.<br />

• Embedded head section style rules: Cascading styling for items used repetitive-<br />

145

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!