HTML and CSS: Digital Media Landscapes
HTML and CSS: Digital Media Landscapes
Slide 1
d i g i ta l m e d i a l a n d s c a p e s
HTML / CSS
Slide 2
d i g i ta l m e d i a l a n d s c a p e s
Syntax
CSS has two parts: a selector and one more declarations:
d e c l e r at i o n s
HTML / CSS
Slide 3
d i g i ta l m e d i a l a n d s c a p e s
Selectors
There are three types of selectors, id, classes and html elements
i d s e l e c t o r s s ta r t w i t h #
#container {text-align:center}
c l a s s s e l e c t o r s s ta r t w i t h .
.center {text-align:center}
p {text-align: center}
HTML / CSS
Slide 4
d i g i ta l m e d i a l a n d s c a p e s
Implementation
Inline
Using the style attribute in HTML elements
Internal
Using the <style> element in the <head> section
External
Using an external CSS file
HTML / CSS
Slide 5
d i g i ta l m e d i a l a n d s c a p e s
Inline Example
<!DOCTYPE html>
<html>
<body style=background-color:yellow;>
<h2 style=background-color:red;>This is a
heading</h2>
<p style=background-color:green;>This is a
paragraph.</p>
</body>
</html>
HTML / CSS
Slide 6
d i g i ta l m e d i a l a n d s c a p e s
Internal Example
<head>
<style type=text/css>
body {background-color:yellow;}
p {color:blue;}
</style>
</head>
HTML / CSS
Slide 7
d i g i ta l m e d i a l a n d s c a p e s
External Example
External style sheet is basically linked to in the head tag. Its
the most effective way to manage styles.
<head>
<link rel=stylesheet type=text/css
href=mystyle.css>
</head>
HTML / CSS
Slide 8
d i g i ta l m e d i a l a n d s c a p e s
Box Model
All HTML elements can be considered as boxes. In CSS, the
term box model is used when talking about design and
layout. The CSS box model is essentially a box that wraps
around HTML elements, and it consists of: margins, borders,
padding, and the actual content. The box model allows us to
place a border around elements and space elements in relation
to other elements.
Margin
Content
Border
Padding
HTML / CSS
Slide 9
d i g i ta l m e d i a l a n d s c a p e s
Box Model
Margin
Clears an area around the border. The margin does not
have a background color, it is completely transparent
Border
A border that goes around the padding and content. The
border is affected by the background color of the box
Padding
Clears an area around the content. The padding is
affected by the background color of the box
Content
The content of the box, where text and images appear
HTML / CSS
Slide 10
d i g i ta l m e d i a l a n d s c a p e s
HTML / CSS
Slide 11
d i g i ta l m e d i a l a n d s c a p e s
Page Layout
Originally HTML used tables and the columns and
rows were manually manipulated to create the
structure. Now we use imaginary divisions called
divs. A div is an HTML element and is assigned
an id attribute.
The right selectors for the right attribute
Generally people assigns ids to divs, and classes
to html elements. Its an easy way to keep them
visually separated
HTML / CSS
Slide 12
d i g i ta l m e d i a l a n d s c a p e s
W3C
They release updates of HTML and CSS. They also set
the standards
HTML / CSS
Slide 13
d i g i ta l m e d i a l a n d s c a p e s
Browser Compatibility
Browser have their own rendering engine, so HTML/
CSS can be rendered differently across different
browsers. Safari, Chrome and Firefox are pretty
standards compliant, but Internet Explorer still has
some weird quirks so sometimes front end quicks have
to have ie hacks to get things to look right in IE. IE 6 and
7 were the worstwhole IE stylesheets had to be created
to make websites render right in those browsers.
HTML / CSS
Slide 14
d i g i ta l m e d i a l a n d s c a p e s
Inspecting Code
HTML / CSS is not protected, meaning you can see the
source code of any website. Modern browsers actually
allow you inspect the content and return the css rules for
the html elements.
HTML / CSS
Slide 15
d i g i ta l m e d i a l a n d s c a p e s
HTML Editors
There is no such things as pure WYSIWYG HTML
editor. In order to build a site that actually renders
correctly, you have to learn HTML/CSS. Understanding
how Dreamweaver works doesnt mean you write
markup. HTML editors exist to for efficiency.
HTML / CSS
Slide 16
d i g i ta l m e d i a l a n d s c a p e s
HTML / CSS
Slide 17
d i g i ta l m e d i a l a n d s c a p e s
Web Fonts
CSS is being rendered real time by your browser this includes fonts.
So when a website specifics a typeface, the browser searches your
computer for that particular font. CSS uses a font stack so that if
your computer does not have the font, it defaults to the second,
third, etc... Given the vast number of typefaces in existence, its hard
to anticipate what fonts a user will have installed. This lead to the
creation of web safe fontsthese are typefaces that are on 99% of
computers. They include:
Serif
Georgia, Palatino Linotype, Times New Roman
Sans Serif
Arial, Helvetica, Comic Sans, Impact, Lucinda, Tahoma, Trebuchet,
Verdana
Monospace
Courier