Presentation of Cascading Style Sheets (CSS)
Presentation of Cascading Style Sheets (CSS)
3 Ways
– External style sheet
– Internal style sheet
– Inline style
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
NAPD Web Design and Development
7/30/23 6
Course
Here is how the "mystyle.css" looks:
<style>
body {
background-color: lightblue;
}
h1 {
color: navy;
margin-left: 20px;
}
</style>
NAPD Web Design and Development
7/30/23 7
Course
Internal Style Sheet
<head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head>
• <!DOCTYPE html>
• <html>
• <body>
• <h1 style="color:blue;margin-left:30px;">This is a
heading</h1>
• <p>This is a paragraph.</p>
• </body>
• </html>
NAPD Web Design and Development
7/30/23 9
Course
Multiple Style Sheets
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
<style>
h1 {
color: orange;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>The style of this document is a combination of an external stylesheet, and
internal style</p>
</body>
</html>
7/30/23
NAPD Web Design and Development
10
Course
Color Names