240 likes | 358 Views
Page Structure, Box Model, Colors. 21 January 2014. From the first two labs. Common Mistakes. Validating on your machine, not isis Remember Fred Flintstone : Head and body AND NOTHING ELSE Look at effect of commands font-style: inherit;. Page Structure. The Body. Every page needs
E N D
Page Structure, Box Model, Colors 21 January 2014
Common Mistakes • Validating on your machine, not isis • Remember Fred Flintstone: • Head and body AND NOTHING ELSE • Look at effect of commands • font-style: inherit;
The Body • Every page needs • Header (DIFFERENT THAN head) • Content • Footer • Minimal content • Header: title • Footer: who wrote it and when
Dividing Up the Body Basic model: <header>…</header> Use for main title <main> … </main>* Use for the main content <footer> … </footer> Use for accreditations and citations Each section can be formatted independently * New tag, may not be offered by komodo editor
Box Model Allows us to place borders, and space elements in relation to other elements Here’s where Inspect Element starts being important!
Box Model • Margin – clears an area around the border. Does not have a background color – it is transparent • Border – a border that goes around the padding and content. Affected by the background color of the box. • Padding – clears an area around the content. Affected by background color of the box • Content – the content of the box, where text appears.
A cool new feature • Rounded corners on boxes • border-radius: 15px; • New with the latest version of CSS • If not supported by a browser, you get square corners!
Centering centering the TEXT text-align: center; centering the BOX Need to tell it to treat as a block display: block; Must have a width (px or %) center using margin margin-left: auto; margin-right: auto;
Centering list items • One of the areas with browser differences • In some cases (Firefox), centering text centers the bullet • In other cases (Chrome), centering text does not center the bullet • Solution: list-style-position: inside; bullets INSIDE the list item’s formatting
Colors – Paint (Subtractive Color Model) • Primaries: magenta, yellow, and cyan • This color system is called subtractive because: • each primary color absorbs (subtracts) a certain part of the color spectrum. • every time a color is added, less light is reflected. • When you mix all three primaries together, the entire spectrum of color is absorbed, and we’re left with black.
Colors -- Computer Screen (Additive Color System) • Primaries: Red, Blue, Green • Additive color systems start without light (black). • Light sources combine to make a color. • As colors are added, the resulting color is brighter.
Colors • We’ll be working with the additive color system • Mix various amounts of red, green, and blue to create a color. • Colors can be represented by • name • an rgb (dec, dec, dec) value • hexadecimal (# hxhxhx) value.
Colors (cont) • For RGB, each color is indicated by a number from 0-255 • (0,0,0) = black • (255,255,255) = white • For Hexadecimal (hex), each color is indicated by 6 values from 0 – F • #000000 = black • #FFFFFF = white
Hex... #ADFAA5 • Each two letters/numbers represent red, green, or blue in that order. • Examples: • #FF0000 = red • #00FF00 = green • #0000FF = blue #E01B4C #0F6480
Why Hexadecimal? • How do computers store information? • Bits 1 and 0 • Binary numbers are too hard to use • Group them together in groups of 4 • That’s hexademical!
Color Shorthand • Sometimes you will see colors as #123 • This is the same as #112233 • Why? Still a pretty broad range of colors http://www.december.com/html/spec/color3hex1.html
Helpful Color Links • A list of color names • colorpicker.com
Identifying Colors • Eyedropper for Chrome • Colorzilla for Firefox • Colorpic
Special symbols • < and > are special symbols with special meanings How would you display A < B ? Suggestions? • < for < and >for > & is an escape symbol, handled specially. Always ends with ; • Means that you need a special way to display “&” too: & • Full lists at http://www.w3schools.com/tags/ref_entities.asp http://www.utexas.edu/learn/html/spchar.html