-
Notifications
You must be signed in to change notification settings - Fork 35
/
01-html.html
95 lines (95 loc) · 5.6 KB
/
01-html.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<title>Software Carpentry: HTML</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap-theme.css" />
<link rel="stylesheet" type="text/css" href="css/swc.css" />
<link rel="alternate" type="application/rss+xml" title="Software Carpentry Blog" href="http://software-carpentry.org/feed.xml"/>
<meta charset="UTF-8" />
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class="lesson">
<div class="container card">
<div class="banner">
<a href="http://software-carpentry.org" title="Software Carpentry">
<img alt="Software Carpentry banner" src="img/software-carpentry-banner.png" />
</a>
</div>
<div class="row">
<div class="col-md-10 col-md-offset-1">
<h1 class="title">HTML</h1>
<h2 class="subtitle">Making things appear in your browser</h2>
<div id="learning-objectives" class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
<li>Create your first web page and view it in a browser</li>
<li>Understand the structure of an HTML document</li>
<li>Understand the different elements within an HTML document</li>
</ul>
</div>
</div>
<p>A way of writing that is understood by all web browsers is HTML: hypertext markup language. Since we don’t have the ability to do logical operations (loops, etc.) with HTML alone, it’s not technically a programming language.</p>
<p>Let’s see how we can get our browser to greet the world. We need to:</p>
<ul>
<li>Create a local folder 'my_first_webpage'</li>
<li>In the folder, create the file 'index.html'</li>
<li>Open the file with a text editor</li>
</ul>
<p>Now, if we want to open our new file in a browser, we have to tell it what kind of file to expect. To do this, we start our file with:</p>
<pre class="sourceCode html"><code class="sourceCode html"><span class="dt"><!DOCTYPE </span>html<span class="dt">></span>
<span class="kw"><html></span>
--> Everything goes in here <span class="er"><</span>--
<span class="kw"></html></span> </code></pre>
<p>Every good webpage consists of a head and a body. The header (<head> to open and </head> to close) normally contains any meta-data. This could be name of the page or the inclusion of other files.</p>
<p>The body (<body> to open and </body> to close) is where all our content should go. So everything we type between the brackets will be displayed on our page.</p>
<pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><head></span>
<span class="kw"></head></span>
<span class="kw"><body></span>
Hello world!
<span class="kw"></body></span> </code></pre>
<p>Since our browser understands this language, we can instantly open our local index.html file and the browser will interpret our code as visual components.</p>
<p>HTML has more predefined elements that will vary in size and style. To divide the page into different section, we can create a division using <div> to open and </div> to close it.</p>
<pre class="sourceCode html"><code class="sourceCode html"><span class="dt"><!DOCTYPE </span>html<span class="dt">></span>
<span class="kw"><html></span>
<span class="kw"><head></span>
--> meta-data (like page title, inclusion of other files) <span class="er"><</span>--
<span class="kw"></head></span>
<span class="kw"><body></span>
<span class="kw"><div></span>Hello world!<span class="kw"></div></span>
<span class="kw"><div></span>Hello back!<span class="kw"></div></span>
<span class="kw"></body></span>
<span class="kw"></html></span> </code></pre>
<div id="other-elements" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Other elements</h2>
</div>
<div class="panel-body">
<p>Create a folder that contains the file index.html (or download it). What seems to be the difference between <div>, <h1>, and <em>? What about the difference between two <div> elements and two <span> elements? Create a heading that is in italics. Never be afraid to google to find out how to use certain elements and find out about the syntax!</p>
</div>
</div>
<p>Useful resources are also the mozilla developer network (<a href="https://developer.mozilla.org/en-US/">MDN</a>) and <a href="http://www.w3schools.com">w3school</a>.</p>
</div>
</div>
<div class="footer">
<a class="label swc-blue-bg" href="http://software-carpentry.org">Software Carpentry</a>
<a class="label swc-blue-bg" href="https://github.com/swcarpentry/lesson-template">Source</a>
<a class="label swc-blue-bg" href="mailto:[email protected]">Contact</a>
<a class="label swc-blue-bg" href="LICENSE.html">License</a>
</div>
</div>
<!-- Javascript placed at the end of the document so the pages load faster -->
<script src="js/jquery.min.js"></script>
<script src="css/bootstrap/bootstrap-js/bootstrap.js"></script>
</body>
</html>