Академический Документы
Профессиональный Документы
Культура Документы
W </> R K S H O P
BY
<!DOCTYPE html>
<html>
<head>
<title>My title</title>
</head>
<body>
Main content goes here
</body>
</html>
• Link Text
<a href=“http://www.ucsdtritons.com”>Go Tritons!</a>
• Image link
<a href=“http://www.ucsdtritons.com”><img
src=“http://upload.wikimedia.org/wikipedia/commons/f/f6/UCSD_logo.png” width=“200”></a>
BASIC HTML TAGS
<!DOCTYPE html>
<html>
<head>
<title>My title</title>
</head>
<body>
<p>Paragraph Text</p>
<img src=“http://upload.wikimedia.org/wikipedia/commons/f/f6/UCSD_logo.png” />
<a href=“http://www.ucsdtritons.com”>Go Tritons!</a>
<a href=“http://www.ucsdtritons.com”><img
src=“http://upload.wikimedia.org/wikipedia/commons/f/f6/UCSD_logo.png” width=“200” /></a>
</body>
</html>
MORE BASIC HTML TAGS
• Line break
<br />
• Headings
<h1>My biggest heading</h1>
…
<h6>My smallest heading</h6>
• Bold
<strong>HELP!</strong>
• Italics
<em>Italicize me</em>
Two problems:
1. We have to type the same text over
and over and over—or copy and paste
it many times.
2. If we change the style, we have to
change it in many places.
STYLE SHEETS
HTML File main.css
<!DOCTYPE html> .maintext {
<html> font-size: 20px;
<head> color: red;
<title>My title</title> text-decoration: underline;
<link href="main.css" rel="stylesheet" type="text/css" font-weight: bold;
/> }
</head>
<body>
<p class="maintext">First paragraph</p>
<p class="maintext">Second paragraph</p>
<p class="maintext">Third paragraph</p>
<p class="maintext">Fourth paragraph</p>
<p class="maintext">Fifth paragraph</p>
<p class="maintext">Sixth paragraph</p>
<p class="maintext">Seventh paragraph</p>
</body>
</html>
CSS FORMAT
file.css
/* Comments */
selector {
property: value;
property: value;
…
}
selector {
property: value;
property: value;
…
}
selector {
property: value;
property: value;
…
}
COMMON CSS PROPERTIES
• Have links turn red when the cursor rolls over them:
a:hover {
color: red;
}
960 x 50
960 x 50
660 x ??
660 x ??
300 x ??
960 x 50
CODE FOR PREVIOUS LAYOUT
HTML File main.css
#container {
width: 960px;
<!DOCTYPE html> }
margin: 10px auto 10px;
<html>
#header {
height: 50px;
<head> width: 960px;
float: left;
<title>My Page</title> }
</head>
#sidebar {
<body> width: 300px;
float: left;
}
<div id="container">
#maincontent {
<div id="header">Header</div> width: 660px;
float: left;
}
<div id="navigation">Navigation</div>
<div id="sidebar">Sidebar</div> #article {
width: 660px;
float: left;
<div id="maincontent"> }
</div> #footer {
height: 50px;
<div id="footer">Footer</div> width: 960px;
float: left;
}
</div>
</body>
</html>
BOX MODEL
• Elements populate the page in what's known as the CSS box
model. Each HTML element is like a tiny box or container that
holds the pictures and text you specify.