HTML Basics: This Work Is Licensed Under A
HTML Basics: This Work Is Licensed Under A
HTML Basics
● Web Browser
○ Any of your choice. (Chrome is Recommended).
● Code Editor
○ VS Code
○ Sublime Text
○ Atom, and so on
For this course, we are using VS code, you can
download the latest version at
https://code.visualstudio.com/
Languages and Tools of Web
Development
● Every website has two parts:
○ Front-End - What you see in the browser (Visual Aspect).
■ Front-end developers use HTML, CSS and Javascript
○ Back-End - Behind the scene (Powers the Front-End)
How the Web Works
● What HTML is
● What tags are
● What a basic web page look like
● What 3 HTML tags are required
● What HTML comments look like
● How to title your web page
● How to format the text on your web page
● How to create headings on your web page
● How to add pictures to your page
What is HTML?
● <tagname>Content</tagname>
● Some tags close themselves (Self closing tags - no
content)
○ <br/> or <br> in HTML5
○ <img src =” “ alt = “ “>
Basic Web Page (Boilerplate Tags)
<html>
<head> Head section
</html>
Head Elements and Scripts
Setting the viewport to make your website look good on all devices:
Line break Makes the browser go to I’m Line 1. <br /> I’m Line 2.
the next line
Bold Makes the text bold <strong> I’m bold </strong>
<html>
<head> Head section
● Elements
○ Another name for the begin and end tag and everything in
between
○ Everything that is in-between and includes the <body> and
</body> tags is the body element.
○ <title> and </title> are tags, BUT <title>Rumple
Stiltskin</title> is a title element.
HTML5 Attributes
● Open the first page and add a link called “Click Here to
See Second”. When you click on this link, it should
open the second page
● Open the second page and add a link called “Click Here
to See My First Page”. When you click on this link, it
should open your first page.
HTML
pictures
Project
folder
4.hml
THIS IS MY ROWS
SITE
<table border=“1”>
<tr>
<td colspan=“2”>Row 1 col 1 and 2</td>
</tr>
<tr>
<td>Row 2 col 1</td>
<td>Row 2 col 2</td>
</tr>
</table>
Row 1 and Row 2 Col Row 1 Col 2
Combining the 1
<table border=“1”>
<tr>
<td rowspan=“2”>Row 1 and Row 2 col 1</td>
<td>Row 1 Col 2</td>
</tr>
<tr>
<td>Row 2 col 2</td>
</tr>
</table>
Coloring Tables
• Pick
how wide you want your table to be
• What’s the resolution of your computer screen?
•Column width?
○ method="post"
■ Form data is sent in the body of the URL request
○ target="target"
■ Tells where to open the page sent as a result of the request
■ target= _blank means open in a new window
■ target= _top means use the same window
71
The <input> tag
● Most, but not all, form elements use the input tag,
with a type="..." argument to tell which kind of
element it is
○ type can be text, checkbox, radio, password, hidden, submit,
reset, button, file, or image
● Other common input tag arguments include:
○ name: the name of the element
○ value: the “value” of the element; used in different ways for
different values of type
○ readonly: the value cannot be changed
○ disabled: the user can’t do anything with this element
○ Other arguments are defined for the input tag but have
72
meaning only for certain values of type
Text input
A text field:
<input type="text" name="textfield" value="with an initial
value">
A password field:
<input type="password" name="textfield3"
value="secret">
• Note that two of these use the input tag, but one uses 73
textarea
Buttons
• A submit button:
<input type="submit" name="Submit" value="Submit">
• A reset button:
<input type="reset" name="Submit2" value="Reset">
• A plain button:
<input type="button" name="Submit3" value="Push Me">
● type: "checkbox"
● name: used to reference this form element from
JavaScript
● value: value to be returned when element is
checked
● Note that there is no text associated with the
checkbox—you have to supply text in the 75
surrounding HTML
Radio buttons
Radio buttons:<br>
<input type="radio" name="radiobutton" value="myValue1">
male<br>
<input type="radio" name="radiobutton" value="myValue2" checked>
female
● Additional arguments:
○ size: the number of items visible in the list (default is "1")
○ multiple: if set to "true", any number of items may be
selected (default is "false")
77
Hidden fields
● <input type="hidden" name="hiddenField" value="nyah">
<-- right there, don't you see it?
78
A complete example
<html>
<head>
<title>Get Identity</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<p><b>Who are you?</b></p>
<form method="post" action="">
<p>Name:
<input type="text" name="textfield">
</p>
<p>Gender:
<input type="radio" name="gender" value="m">Male
<input type="radio" name="gender" value="f">Female</p>
</form>
</body>
</html>
More on HTML5 can be found at this link:
https://www.tutorialspoint.com/html5/html5_web_forms2.htm
79
HTML Validation