Top Banner
CSS – Presentation of Information
15

CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

Dec 28, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

CSS – Presentation of Information

Page 2: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

Types of Style Sheets

External<link rel = “stylesheet” href=“mystyles.css” type=“text/css”/>

Embedded<style type = “text/css”>

h1{color:red; font-family: Arial;}

</style>

Inline

<h1 style=“color:red; font-family:arial”> Text is here.

</h1>

Page 3: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

Example of CSS

Separate language with its own syntax

1.Selectors: Selects the element to be affected

2.Declaration: “declares” a style for a selected element

Declaration block: property & value

Page 4: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

Types of SelectorsElement Type Selectors

•Used to redefine a specific HTML tag• p {color: blue;}• Grouped - h1, h2, p, em, img { border: 1px solid blue; }• Descendant Selectors - Ex: li em { color: silver; }

targets emphasized text only when in a list item (li)

ID Selectors

•Gives an element a unique identifying name• #content { margin-left: 10px; }

Class Selectors

•Used to “classify” elements into a conceptual group•.special { color: orange; }

Pseudo-Class Selectors

Page 5: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

Organizing Page ContentPage layout

Page 6: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

HTML Common Elements

Block & Inline Elements

Block Elements Ex: <p /> <h1>…</h1>Each block element begins a new lineHave space above and below the element by default

<h1> This is the most important heading </h1>

<p> This is a paragraph </p>

Inline Elements Ex: <em>…</em>Flow within other elements (do not start new line)

<p> This is a paragraph with <em> emphasized text </em> within (inline) the paragraph element </p>

Page 7: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

The Box Model

Block and inline elements are seen as being contained in

rectangular boxes

Page 8: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

CSS Padding, Borders, Margins

Width & height of element

Padding

Border

Margin

Page 9: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

Generic Elements

<div>…</div>Generic block-level element

<span>…</span>Generic block-level element

Name them using id or class

Used to create a logical grouping of content or elements on the pageCan be customized to describe content

Have no inherent presentation qualities of their own, but can use style sheets to format them-allows you to accurately describe content-creates a “hook” for adding style rules

Page 10: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

CSS for layout

Exampleshttp://www.shinybytes.com/newcss.html

Page 11: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

Generic Elements

<div>…</div>•Generic block-level elements•Used like a container to group content•Gives context to the elements in the grouping

•Use a unique id or class to give it a descriptive name

<div class =“listing”><img src=“type-book-cover.gif” alt=“description”><p><cite>The Complete Manual of Type</cite>, John

Doe</p><p>A combination of type history and examples of

good and bad type design.</p></div>

<div id =“news”><h1>This Week</h1><p>We’ve been working on…</p><p>And last but not least…</p>

</div>

Used to create a logical grouping of content or elements on the pageCan be customized to describe content

Page 12: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

Generic Elements<span>…</span>

•Generic inline element•Can only contain text and other inline elements•Gives context to the elements in the grouping

•Use a unique id or class to give it a descriptive name

<ul> <li> Andy: <span

class=“tel”>414-123-4567</span></li> <li> Joe: <span

class=“tel”>414-101-0101</span></li> <li> Mary: <span class=“tel”>414-255-1212</span></li> </ul>

Page 13: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

HTML 5 Elements

<section>…</section>

•May be used to divide pages into major sections | major thematic sections<section>

<h2>Typography Books</h2><ul> <li>…</li></ul>

</section><article>…</article>

•May be used for self-contained works that could stand alone or be reused in a different context

<article><h1>Get To Know Helvetica</h1><section> <h2>History of Helvetica</h2> <p>…</p></section>

</article>

Well supported by current desktop and mobile browsers(known issues with IE 8 and earlier)

Page 14: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

HTML 5 Elements

<aside>…</aside>

•Related to the surrounding content

<nav>…</nav>

•Primary navigation links

<header>…</header>

•Introductory material for page, section, or article

<footer>…</footer>

•Footer for page, section, or article

<address>…</address>

•Contact information

Well supported by current desktop and mobile browsers(known issues with IE 8 and earlier)

Page 15: CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.

CSS for layout