6.148 WEBday3 Htmlcss
6.148 WEBday3 Htmlcss
148
HTML / CSS
Victor Hung
HTML
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Title!</title>
</head>
<body>
<h1>Heading!</h1>
<p>Paragraph!</p>
</body>
</html>
<body>
Document Body
<head>
Header Tags
<p>
Paragraph Tags
<img>
Image
<a>
Hyperlink
<div>
Section in a Document
<span>
unordered list
unordered list
list item
unordered list
list item
unordered list
list item
item 1
item 2
HTML Attributes
<a>Google</a>
HTML Attributes
<a href="http://google.com">Google</a>
HTML Attributes
<a href="http://google.com">Google</a>
Google
HTML Attributes
<a href=http://google.com>Google</a>
Google
<div>Some text</div>
HTML Attributes
<a href=http://google.com>Google</a>
Google
HTML Attributes
<a href=http://google.com>Google</a>
Google
<tag name=value">content</tag>
HTML Attributes
<a href=http://google.com>Google</a>
Google
<tag name=value">content</tag>
CSS
CSS
p {
color: red;
font-size: 20pt;
}
Selector
p {
color: red;
font-size: 20pt;
}
Selector
Declaration
p {
color: red;
font-size: 20pt;
}
Property
p {
color: red;
font-size: 20pt;
}
Property
Value
p {
color: red;
font-size: 20pt;
}
Property
Value
Semicolon
p {
color: red;
font-size: 20pt;
}
p {
color: red;
font-size: 20pt;
}
<p>This here is a lovely paragraph,
full of good news and bad.</p>
.intro {
color: red;
font-size: 20pt;
}
<p class=intro>This here is a lovely
paragraph, full of good news and
bad.</p>
<p>I write very short paragraphs</p>
#id {
color: red;
font-size: 20pt;
}
<p id=intro>This here is a lovely
paragraph, full of good news and
bad.</p>
<p>I write very short paragraphs</p>
ID #intro
CONTENT
CONTENT
CONTENT
CONTENT
div {
border: 1px solid red;
}
div {
border-style: solid;
border-color: red;
border-width: 1px;
}
div {
border-style: solid;
border-color: red;
border-width: 1px 3px;
}
div {
border-style: solid;
border-color: red;
border-width: 1px 3px;
}
TOP & BOTTOM, RIGHT & LEFT
div {
border-style: solid;
border-color: red;
border-width: 1px 3px 1px 3px;
}
div {
border-bottom: 1px solid red;
}
div {
margin: 10px;
border: 1px solid red;
}
div {
padding: 10px;
border: 1px solid red;
}
CSS Positioning
<body>
<div>here is some text</div>
<div class=content>bloop!</div>
</body>
body {
position: relative;
}
.content {
position: relative;
}
CSS Positioning
<body>
<div>here is some text</div>
<div class=content>bloop!</div>
</body>
body {
position: relative;
}
.content {
position: relative;
top: 20px;
}
CSS Positioning
<body>
<div>here is some text</div>
<div class=content>bloop!</div>
</body>
body {
position: relative;
}
.content {
position: absolute;
top: 10px;
}
CSS Positioning
<body>
<div>here is some text</div>
<div class=content>bloop!</div>
</body>
body {
position: relative;
}
.content {
position: fixed;
top: 20px;
}
CSS Positioning
header
content
CSS Positioning
RELATIVE, 10px
header
content
CSS Positioning
ABSOLUTE (to parent), 10px
header
content
CSS Positioning
FIXED (to window), 10px
header
content
After Lunch!
JavaScript & Nodejs
After Lunch!
JavaScript & Nodejs
Try out some HTML/CSS
http://bit.ly/6148htmlcss