What is HTML?
What are a few different HTML tags?
Which tag is used to create a link to another page?
<l>
<link>
<a>
<p>
What is a container element compared to a stand alone element?
<p></p>
contains
text<br>
and
<img>
.
What are the two tags that nest directly within the
<html>
tags?
<head>
<body>
What is a HTML comment?
<!-- Document Content -->
is only visible in the source code.
Comments can be used to organize your code into sections so you (or someone else) can easily understand your code. It can also be used to 'comment out' large chunks of code to hide it from the browser.
What is a relative path versus an absolute path?
If a file is part of the same web site, then a relative URL can be used. This can be only the name of the file.
If the file is located on another website, an absolute URL must be used. Absolute URLs contain the entire domain name and path.
<!-- Relative URLs -->
<a href="image-gallery.html">Image Gallery</a>
<a href="blog/first-blog-entry.html">My First Blog Entry</a>
<a href="../image-gallery.html">Back to Image Gallery</a>
<!-- Absolute URLs -->
<a href="https://www.my-colleague.com/blog.html">Blog of a Colleague</a>
portrait.jpg
./portrait.jpg
.What does a complete link (anchor) element look like?
<a href="https://google.com/" target="_blank">This goes to google</a>
What does block-level and inline elements mean?
<h1-6>
,
<p>
,
<br>
<a>
,
<em>
,
<strong>
What is an attribute? Explain and list some examples.
class
,
id
,
style
,
src
,
href
, ...What is a HTML entity?
ü
' '
<
–
—
©
¼
½
¾
«
»
ä
Ü
é
è
←
↑
→
↓
A method or technique that has been generally accepted as superior to any alternatives because it produces results that are superior to those achieved by other means or because it has become a standard way of doing things.
All the files for your site should be stored within the same folder.
This includes:
Note: File names should not include spaces or special characters. File names ARE case sensitive.
index.html
INDEX.html
vs.
index.html
.html
vs
.css
vs
.js
After each opening tag, the next element should be indented with a
tab
for better overview. Make
sure you follow this habit.
Action | Windows | Mac |
---|---|---|
VSCode, save |
Ctrl +
s
|
⌘ +
s
|
VSCode, undo |
Ctrl +
z
|
⌘ +
z
|
Switch apps |
Alt +
Tab
|
⌘ +
Tab
|
Chrome, reload |
Ctrl +
r
|
⌘ +
r
|
Your Content
+ HTML: Structure
+ CSS: Presentation
= Your Website
I've got nearly 15 years under my belt as web developer and I still question my use of HTML elements.Stephanie Eckles
The correct interpretation of the meaning of a word or sentence.
Many HTML tags have semantic meaning. That is, the element itself conveys some information about the type of content contained between the opening and closing tags.
What do you see in your mind?
Every time you use a div
or
span
, you tell the browser:
"There's a thing".
Search Engine Optimization (SEO) is a huge and important topic in web development. There are specialists in SEO asking for a lot of money to optimize existing websites.
Semantic HTML and valid code is the base for good SEO. It makes all other SEO measures so much easier.
The goal of Accessibility is that a person with a disability can
as a person without a disability.
Use span
and div
if you need HTML tags
only for presentation purposes.
Try to avoid them in general. Always ask yourself, "is there a tag with better semantic meaning?"
When you google semantic web, you will find the term often in relation with HTML 5.
A lot of new semantic tags were introduced in 2014 with HTML 5, but HTML was from the beginning a language with semantic tags and meaning.
<h1>
for headlines<h2-6>
for sub
headlines<ul>
for unordered
lists<ol>
for ordered
lists<table>
for complex
data<header>
for
introduction of the page, e.g. logo, page headline, content
summary<nav>
as container for
navigational elements, links to access content within the
website<main>
for the main and
most important content of a page<section>
for thematic
grouping of content, e.g. news, team<article>
is
independent, self-contained content, e.g. news entry, blog
entry<aside>
for less
important content, e.g. in a sidebar or overlay<footer>
for information
at the end of document, e.g. copyright, address, author, legal
info
<h>
-tags can be within
different block-level elements, e.g. header, main, article, section,
footer.
Use hierarchical order of headlines,
e.g.:
<h1>
in the
<header>
<h2>
in the
<section>
<h3>
in the
<article>
Each article should contain at least 1 headline.
Each page should only have 1
<h1>
-tag.
Don't leave a number out, e.g. never write first
<h1>
, then
<h3>
.
You can group articles in a section, e.g. news items within the section news.
You can also have several sections within one article, if needed.
Can you think of an example?
The word "boilerplate" means standardized pieces of text for use as clauses in contracts or as part of a computer program.
An HTML boilerplate will contain the most common elements of a page as a sample that can be cloned and used as a starting point for a project.
Let's code our own boilerplate.
What should it contain?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Boilerplate</title>
</head>
<body>
<header>
<h1></h1>
<nav>
</nav>
</header>
<main>
<p></p>
</main>
<footer>
<nav>
</nav>
</footer>
</body>
</html>
Check them out. Most of them are more extensive than our example. Keep in mind: start small and add more if you need it.
Anatomy of domain names:
subdomain.domain.topleveldomain
The most common TLDs are:
.com
: "Commercial
entities".net
: "Networking
companies".org
: "Non-profits"As the use of these TLDs isn't restricted, they are used more flexibly than as originally intended.
Each country has its own TLD (ccTLD), and they can decide who can register for domains with that TLD. Some also specify a set of "second-level-domain" for the TLDs.
.ch
.fr
.it
.de
.uk
/
.co.uk
Since 2013 new generic TLDs were introduced.
Over a thousand new gTLDs:
.hotel
.bank
.florida
.berlin
.toys
.yoga
.tech
.design
.codes
.ninja
Most users expect to type in a
.com
or
.ch
domain, so you should always
try to reserve that name (though it's often taken).
If you're worried about competitors, you should purchase related TLDs (.info, .net, .biz).
If you target a particular geographic market, it makes sense to get the ccTLD.
For your own portfolio one of new gTLDs might be best, e.g.
.codes
or
.dev
.
The domain name must follow these rules:
The domain name is not case-sensitive - google.com = GOOGLE.com.
A good domain name follows these guidelines:
But good domain names are often taken. You can try using hyphens (experts-exchange.com) or making a TLD form part of the name (del.icio.us) to make it more likely the name will be available.
Once you own a domain name, you can make subdomains for different aspects of your product/company, e.g.
The www-Subdomain is the most common. If you type in a domain, e.g. google.com, it automatically refers to the www-subdomain. Try it yourself.
You must use a "domain registrar" to purchase a domain.
Just google "register domain" to find a registrar.
Worldwide the most popular domain registrar is GoDaddy.
I register my domains with Metanet or Infomaniak.
One key success factor of any website and web app is
user engagement.
The more a user engages with a website and the more he interacts,
the more interested he is.
HTML forms are used to acquire user input. These types of interaction include
HTML provides different interactive form controls:
<input>
for single-line
text, radio buttons and checkboxes<textarea>
for
multi-line text<select>
for
dropdowns<form>
For form controls to work they need to be nested inside of a
form-tag
<form></form>
. Two
attributes are required:
action
contains an address
that defines where the form information will be sentmethod
can be either GET or
POST and defines how the form information will be sentOptional attributes are:
novalidate
disables the native
browser form validationautocomplete
name
enctype
is usually only added
when files need to be uploaded<input>
There are different types of input fields, depending on semantics
<input type="password">
for passwords<input type="number">
for numbers<input type="email">
for
email address<input type="url">
for
url<input type="tel">
for
number<input type="search">
for submitting a search keywordEven more input fields
<input type="time">
<input type="date">
<input type="week">
<input type="month">
<input type="datetime-local">
<input type="range">
<input type="color">
<input type="file">
<input type="hidden">
<input type="image">
Depending on the attribute "type", browsers display different UI and use different validation.
Let's try it out.
name
is a
required unique identifier for the input
fieldvalue
lets you define a
default valueplaceholder
gives a hint which
information is neededrequired
defines an input as
mandatory and the native form validation kicks in (another HTML5
API)autofocus
automatically puts
the cursor in the input fieldautocomplete
is
on to fill in data from a previous form
submission and off for more private data, e.g.
credit card informationlist
sets the id of a datalist
to add suggestions to an input fieldid
defines a unique
identifier
The attribute for
corresponds
with the id
of the input field.
<form action="do_something.html" method="post">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname" required>
</form>
This includes the order of fields, the form’s appearance on the page, and the logical connections between different fields.
Long forms with a lot of input fields can become unreadable and very user-unfriendly.
The <fieldset>
tag allows
you to group form fields that share the same purpose.
Label the group with a nested
<legend>
tag.
<form action="do_something.html" method="post">
<fieldset id="personal-info">
<legend>Personal Info</legend>
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname" required>
</fieldset>
</form>
The form will have at least one call to action (the button that triggers data submission).
<input type="button">
for creating a button without default action<input type="submit">
for submitting a form<input type="reset">
for
resetting a formIt is very important to give users feedback in their form entry as well as submission.
tabindex="0"
pattern="^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"
(hex-color)placeholder="e.g. +41 78 123 45 67"
e.g. type="tel"
<a>
Hyperlinks are the main tool for interacting and engaging. You can and should use them:
Make sure to use keywords in your link. Instead of Read more use Read more about Powercoders.
Next to relative and absolute paths it is also possible to use an
<a>
-tag as
anchors.
Anchors are specific elements you can define by giving them an id.
You can then link within a page not to the top, but to a specific element (anchor).
<a href="#subtitle2">This goes to the element with the id subtitle2</a>
<h2 id="subtitle2">This is my second subtitle</h2>
<a href="/blog/#subtitle2">
This goes to the element with the id subtitle2 on the page "blog"
</a>
Use it semantically correct, don't surprise the user, you can style links as buttons and vice verse, as long as the user always knows what to expect.
<audio>
to embed sound
content in a website<video>
to embed video
content in a websiteThese interactive tags work with a Javascript API modern browsers have natively integrated.
API = Application Programming Interface to allow one application to access features and data from the OS (operating system), another service or application.
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
<p>Your browser doesn't support HTML5 audio.
Here is a <a href="horse.mp3">link to the audio</a> instead.</p>
</audio>
<audio>
Check all attributes and possibilities on:
<video>
<video poster="horse.png" controls>
<source src="horse.mp4" type="video/mp4">
<source src="horse.webm" type="video/webm">
<p>Your browser doesn't support HTML5 video.
Here is a <a href="horse.mp4">link to the video</a> instead.</p>
</video>
These formats compress the video and audio data into manageable files. Browsers use different codecs to convert the compressed data back.