ideas to layout beginning web layout using cascading style sheets (css). basic ideas, practices,...

19
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site using CSS. CB Averitt Florence-Darlington Technical College [email protected]

Upload: ryan-braley

Post on 14-Dec-2015

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Ideas to LayoutBeginning web layout using Cascading Style

Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web

site using CSS.

CB AverittFlorence-Darlington Technical College

[email protected]

Page 2: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Topics• What is CSS• CSS Syntax• 4 CSS’s• Classes• ID• <div> tag• Tools & Resources• CSS Best Practices• What Browser should be

used in designs and layouts?

•My Challenges•Media Types•Links with Preloaded Images•Button Rollovers – Sprites•CSS’s relationship with accessibility•Let’s Build a Page•Questions?

Page 3: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

What is CSS?

– CSS stands for Cascading Style Sheets– Styles define how to display HTML elements– Styles are normally stored in Style Sheets – Styles were added to HTML 4.0 to solve a problem– External Style Sheets can save you a lot of work– External Style Sheets are stored in CSS files– Multiple style definitions will cascade into one

w3schools.com

Page 4: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

CSS Syntax– Selector {property: value} - example:

body {color: black}

– More than one property – Semicolon - Selector {property1: value1; property2: value2;} example:

p {text-align: center; color: red}

– Readable – example:p {text-align: center;color: black;font-family: arial;}

– Grouping – use a commah1,h2,h3,h4,h5,h6 {color: green;}

Page 5: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

4 css’s– Browser Default– External style sheet – example

<link rel="stylesheet" type="text/css" href="main.css" />

– Internal style sheet (inside the head tag) – example:

www.powersaviation.com

– Inline style (inside an html element) – example<p style="background: blue; color: white;">A new background

and font color with inline CSS</p>link

Page 6: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Classes – Different styles for the same type of html element –

example:p.right {text-align: right;}p.center {text-align: center;}p.left {text-align: left;}<p class="right">This paragraph will be right-aligned.</p><p class="center">This paragraph will be center-aligned.</p><p class=“left">This paragraph will be left-aligned.</p>link

Page 7: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

ID

– HTML elements with particular attributes. a unique identifier to an element - example:

#red {color: red;}<p id="red">This paragraph will be the color red. This paragraph

will be the color red. This paragraph will be the color red. This paragraph will be the color red. This paragraph will be the color red. This paragraph will be the color red. This paragraph will be the color red. This paragraph will be the color red. This paragraph will be the color red. This paragraph will be the color red. </p>

link

Page 8: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

<div> tag

– defines a division or a section in an HTML document.

– is often used to group block-elements to format them with styles.

– Browsers add a <br /> between

Page 9: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Tools & Resources

– Dreamweaver– Web Developer for Firefox– Cssfly.net – www.cssfly.net – www.w3schools.com – Google– Validation– Existing Websites

Page 10: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

CSS Best Practices– Doc Types – examples:

http://www.w3schools.com/tags/tag_doctype.asp • The doctype declaration should be the very first thing in an

HTML document, before the <html> tag.• The doctype declaration is not an HTML tag; it is an

instruction to the web browser about what version of the markup language the page is written in.

• The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers can render the content correctly. link

– xhtml• Closing – example: <p>This is some text.</p>• Self closing – example: <hr />

Page 11: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Best Practices continued– Use standard html tags first - H1, H2, etc.– Defining styles (browsers may be different –

default styles)– Screen Resolutions• 1024 X 768• What are the big boys doing?

– CSS Comments – example: /* This is a comment */

Page 12: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

What Browser should be used in designs and layouts?

– Types• Firefox• Internet Explorer 7• Internet Explorer 6• Safari• Opera• Chrome

– Browser StatsOver the last 30 days IE is 93%,

Firefox is 5.6% and Safari is .68%. Within IE, IE 7.0 is 90%, IE 6.0 is 9% and IE 8.0 is .8%.

All Of Them!!

Page 13: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

My challenges in the beginning

– Pushing a page down (min-height. IE 6.0)– Do not start your class name with a number –

example: #1heading {color: black;}– Site Centering– Positioning on the parent - link

Page 14: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Media Types

– example: <link rel="stylesheet" type="text/css"

href="/source/fdtc_screen.css" media="screen"> <link rel="stylesheet" type="text/css" href="/source/print2.css"

media="print">

http://www.w3schools.com/css/css_mediatypes.asp & link

Page 15: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Links with preloaded images

– example: www.imperialinktattoo.net

Page 16: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Button rollovers – Sprites

– example: www.ptli.org https://www.ptli.org//source/images/button2.jpg

– Entire site as one big image with positioning.

Page 17: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

CSS’s relationship with accessibility

– Converting from tables to CSS is the first step.– Not an “end all”• Alt tags on images• Closed Captioning/Transcripts for videos• Links that make sense – avoid “click here”• Organize page with H1, H2, p, etc

Page 18: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Let’s Build a Page

Page 19: Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site

Questions?

CB [email protected]