class: middle, center ![HTML](img/html5.png) [http://pjb3.me/bewd-html](http://pjb3.me/bewd-html) .footnote[ created with [remark](http://github.com/gnab/remark) ] --- # HTML HTML stands for HyperText Markup Language. A markup language is not a programming language, it is a formatting language. HTML is the formatting language used by web browsers. A web browser typically loads HTML files from the internet, but it can also display HTML files that are on your local computer. Create a new file using Sublime Text: .terminal $ subl hello.html Put the following code into the file `hello.html`: ```html
Hello, World!
``` Open the file in your default web browser: .terminal $ open hello.html --- # Hello, World! You should see this in your web browser: ![Hello World](img/hello_world.png) --- # Documents The previous HTML file was just a fragment of HTML. The browser can display it properly, but replace the contents of the file with this and then refresh your browser ```html
Example
Hello, World!
``` You should see the same thing, except that the title of the page is also set. The head is for information about the document The body is for the actual content that should be displayed Both the body and the head are tags that contain other tags. All opening tags are surrounded by `<` and `>` characters. The closing tags also have a `/` following the `<` character. --- # Attributes / Images ```html
Example
Hello, World!
``` Tags can have attributes Use `img` for images. The `src` attribute is the URL of the image. --- # Lists ```html
Example
Hello, World!
Tables
Forms
Betamore
``` Use `ul` for unordered lists --- # Lists ```html
Example
Hello, World!
Tables
Forms
Betamore
``` Use `a` for links Use relative paths for links to pages on the same site Use absolute paths for links to pages on other sites --- # Tables tables.html ```html
Tables
Item
Quantity
Unit Price
Total Price
Muffin
2
$2.99
$5.98
Coffee
1
$3.75
$3.75
``` --- # Forms forms.html ```html
``` Forms are for collecting information that can then be sent to the server to process __method__ is for the HTTP method to be used, usually `POST` __action__ is the URL to post the data to --- # Text Field and Labels ```html
Name
``` `
` is for grouping content together The `class` attributes is used for styling with CSS `
` is for putting labels next to the form field `
` will create a field the user can type in. `type` controls what kind of text you expect, `text` is the most generic type `name` and `value` are what is sent to the server --- # Other Input Types ```html
Email
``` Use `type="email"` when you expect the user to enter an email address ```html
Password
``` Use `type="password"` for password fields --- # Checkbox ```html
Yes, I would like to receive your weekly newsletter
``` Use `type="checkbox"` for yes/no questions # Radio buttons ```html
Male
Female
``` Use `type="radio"` for multiple choice questions --- # Select fields ```html
Year Of Birth
1985
1984
1983
1982
1981
1980
1979
1978
1977
1976
1975
``` Use `
` fields with `
` elements for drop-downs --- # Textarea ```html
How would you describe yourself? <textarea name="description" rows="20" cols="80"></textarea>
``` --- # Buttons ```html
Register
``` Use `
` to create a button that will submit for the form to the server