12.09.2015 Views

Boot Camp

Web Authoring Boot Camp - StudioBast

Web Authoring Boot Camp - StudioBast

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Web Authoring <strong>Boot</strong> <strong>Camp</strong><br />

an element. If the style should be applied to a single element instance but only with certain<br />

media, use the id attribute instead of the style attribute.<br />

However, for the purposes of learning cascading style rules, we will focus on using simple<br />

CS inline on web pages, and touch on a little CS use in a web page’s head section. We<br />

will look at more complex CS in a later chapter when we build a cascading style sheet.<br />

Style may be inlined using the style attribute, which may be applied to any body element<br />

(including body itself) except for param, and script. The attribute takes as its value any<br />

number of CS declarations, where each declaration is separated by a semicolon. An example<br />

follows:<br />

I am gray paragraph text.<br />

Embedded Cascading Styles<br />

Embedded head section style rules are another method you use in CS to create a styles to<br />

apply to your HTML code. The benefit comes from creating a style once that can be used<br />

for the same element/tag throughout the web page. They should be used when a single<br />

document has a unique style. If the same style sheet is used in multiple documents, then<br />

an external style sheet would be more appropriate.<br />

Head section CS style rules:<br />

• Are coded in the head section, not the body section of your web page.<br />

• Can be styled once in a page so you can cut down code and be more consistent.<br />

• Follow the strict CS style rules.<br />

• Require you to reference the styles inline in the body section of your page.<br />

• Use a different commenting style than regular HTML code: /* comment */<br />

Head section style rules have the CS standard format which is organized a little differently<br />

than inline:<br />

• Code style: selector, brackets around property/value pairs, semi-colon concluder<br />

for each property/value pairs.<br />

p {color:red; }<br />

• All rules need to have the property/value paired style info inside brackets {}<br />

• Selector: Determines which elements are affected - p {color:red;}<br />

• Declaration: One or more property/value pairs - p {color:red;}<br />

150

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

Saved successfully!

Ooh no, something went wrong!