+ All Categories
Home > Documents > css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design...

css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design...

Date post: 19-Apr-2020
Category:
Upload: others
View: 3 times
Download: 0 times
Share this document with a friend
21
css basics
Transcript
Page 1: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

css basics

Page 2: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

cascading style sheets

“A simple mechanism for adding style to web pages” - w3c

Page 3: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

standard design language for the web

controls color, typography, sizing and layout of elements (i.e. your web pages design)

replaces tables, frames, and presentational hacks

separates presentation (design) from structure (content)

accessibility

global change

bandwidth friendly

Page 4: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

css selectors

tag (html)

class

id

pseudo class (links)

Page 5: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

the css rule

selector declaration property value

p { color: red; }

p { color: #ff0000; }

p { color: #f00; }

p { color: rgba(255,0,0,1); }

p { color: hsla(0,100,54,1); }

Page 6: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

tag selector

ability to “rewrite” every html element

add functionality, change inherent attributes

body, img, p, h1...

Page 7: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

multiple declarationsp { color: rgba(255,0,0,1);

text-indent: 20px; }

body { font-family: Arial, Helvetica, sans-serif;font-size: 13px;color: rgba(32,144,43,1);background-color: rgba(0,43,144,1);

}

Page 8: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

h1 {font-family: "Times New Roman", Times, serif;

}

Page 9: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

class selectors

“dot class”

use multiple times on same page

REUSABLE!

.catch-phrase {font-style: italic;font-weight: bold;color: rgba(22,233,85,1);

}

Page 10: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

pseudo class selectors(css links)

link, visited, hover, active

a:link, a:visited, a:hover, a:active

lvha (love ha!)

Page 11: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

id selectors

“pound id”

unique identifier

only once per web page

good for javascript and jQuery

#special-item {background-color: rgba(32,0,234,1);border: solid 1px rgba(0,0,0,0.8);

width: 61%; padding: 10px; opacity: 0.2;

}

Page 12: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

box model

content

padding

border

margin

Page 13: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

box positionsstatic (in the flow)

“float” relative fixed absolute “z-index”

Page 14: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

descendant selectors

both conditions must be met for declaration to work

.content p {text-indent: 20px;font-style: italic;text-align: right;

}

Page 15: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

useful for styling main navigation links

nav a:link {color: rgba(0,34,200,1);text-decoration: none;

}

Page 16: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

aka contextual class selectors

.about p {text-indent: 20px;

}

p.about {text-indent: 20px;

}

Page 17: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

3 ways to css

external embedded inline

Page 18: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

external style sheet

global cached the right way

<link href=“css/mystyle.css" rel="stylesheet">

Page 19: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

embedded style

<style>p {color: red;}</style>

the “meh” way

Page 20: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

only reason(s) to use embedded

1. single page website (still no) 2. override global style 3. design/ testing process

Page 21: css basics - ATLAS Institutecreative.colorado.edu/atlas2200/pdf/week6-tech-css.pdfstandard design language for the web controls color, typography, sizing and layout of elements (i.e.

inline styles

bulky code, style not separated from content the wrong way

<h1 style=”font-weight: normal;“>just say NO</h1>


Recommended