BogoToBogo
  • Home
  • About
  • Big Data
  • Machine Learning
  • AngularJS
  • Python
  • C++
  • go
  • DevOps
  • Kubernetes
  • Algorithms
  • More...
    • Qt 5
    • Linux
    • FFmpeg
    • Matlab
    • Django 1.8
    • Ruby On Rails
    • HTML5 & CSS

HTML5 Tutorial - Introduction 2020

HTML5-Number5.png




Bookmark and Share





bogotobogo.com site search:






1. Introduction to HTML5

In this chapter, we will go over basic HTML elements how they can be changed in HTML5. Some of them will be shorter and briefer while some of them will be longer.


Example we are going to use is Sample.html.





bogotobogo.com site search:


1.1 Doctype

The doctype

<!DOCTYPE html 
	UBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	ttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

can just be simple like this.

<!DOCTYPE html>

There is a long history behind doctype but it's related to the backward compatibility and compatibility with among browsers. Anyway, that's the HTML5's doctype.


1.2 Root Element

The root element of an HTML page is <html>.
It looks like this:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" >

It is valid HTML5, however, part of it is not needed anymore in HTML5.
Here the xmlns attribute says that elements in this page are in the XHTML namespace, http://www.w3.org/1999/xhtml. But elements in HTML5 are always in this namespace, so we no longer need to declare it explicitly. Our HTML5 page will work exactly the same in all browsers, whether this attribute is present or not. That leaves us with this root element:

<html lang="en">


1.3 Head Element

The first child of the <html> element is usually the <head> element. The <head> element contains metadata which has information about the page. The <head> element itself hasn't changed in any interesting way in HTML5. But inside of the <head> element is worth looking into.

Let's go back to our example's <head> part.

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>BeforeHTML5</title>
  <link rel="stylesheet" type="text/css" href="SampleStyle.css" />
  <link rel="alternate" 
           type="application/atom+xml" 
           title="Web Animation" 
           href="/feed/" />
  <link rel="search" 
           type="application/opensearchdescription+xml" 
           title="Open Source Web Animation" 
           href="opensearch.xml" />
  <link rel="shortcut icon" href="/favicon.ico" />
</head>



1.3.1 Character Encoding - <meta> Element

Then we need to define the document's character encoding since there could be a real security risk if we are not doing it.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

This tells that the web server thinks it's sending us an HTML document using the UTF-8 character encoding.

In HTML5, the line should work as it is. But it can be changed to:

<meta charset="utf-8" />

But followings are equally valid HTML5:

<META CHARSET=UTF-8>
<META CHARSET=UTF-8 />
<META CHARSET="UTF-8">
<META CHARSET="UTF-8" />
<meta charset=utf-8>
<meta charset=utf-8 />
<meta charset="utf-8">
<meta charset="utf-8" />
<Meta CHARset=uTf-8>

Now, we have all the minimum requirements for HTML document.

Really? Let's check with the following html. Note that we do not have <head> and <body>. Amazingly, we do not have <html> tag, either!

Simples_No_html_tag

Simples_No_html_tag_Inspect

As we see from the Chrome Developer Tools, browsers generate the missing tags for us. HTML5 does not require those tags, however, we shouldn't omit the tags. Though there are couple of reasons, for the interest of maintainability we need to keep those optional elements.

So, here is the minimum maintainable HTML5 document.

Minimum_html


1.3.2 Link Relations

While <a href> is simply pointing to another page, link relation, <link rel> is giving additional information when we are linking to:

  1. a stylesheet containing CSS rules.
  2. a feed that contains the same content as this page, but in a standard subscribable format.
  3. the next chapter of an online book that this page is also a part of.
  4. a translation of this page into another language.
  5. the same content as this page, but in PDF format.

rel = "stylesheet"

Let's look at the first link relation in the Sample.html.

<link rel="stylesheet" type="text/css" href="SampleStyle.css" />
is for pointing to CSS rules that are stored in SampleStyle.css. The only drop we can make in HTML5 is the type attribute since there's only one stylesheet language for the web which is CSS. So, no need to specify the type of CSS.

<link rel="stylesheet" href="style-original.css" />

rel = "alternate"
  <link rel="alternate" 
        type="application/atom+xml" 
        title="Web Animation" 
        href="/feed/" />

We call it feed autodiscovery when <link rel="alternate"> is combined with either the RSS or Atom media type in the type attribute. It allows syndicated feed readers to discover that a site has a news feed of the latest articles. Most browsers also support feed autodiscovery by displaying a special icon next to the URL.

The rel="alternate" link relation has always been a strange hybrid with vague definition. In HTML5, its definition has been clarified and extended to more accurately describe existing web content. Using rel="alternate" in conjunction with type=application/atom+xml indicates an Atom feed for the current page. But we can also use rel="alternate" in conjunction with other type attributes to indicate the same content in another format, like PDF.




BookHanSanB






Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization

YouTubeMy YouTube channel

Sponsor Open Source development activities and free contents for everyone.

Thank you.

- K Hong







HTML5 & Javascript



Why HTML5?

HTML 5 Tutorial

Introduction

New Semantic Elements

Canvas

Forms

Offline Storage

Geolocation

Video and Audio

Video and Audio - Before HTML5

CSS

Updating a span when input text changes using DOM API, jQuery, and Backbone

Javascript : text input and event listener




Sponsor Open Source development activities and free contents for everyone.

Thank you.

- K Hong









Data Visualization



Data Visualization Tools

Basics of HTML DOM and D3

Basic D3 Drawings

Data Visualization D3.js

Inscribe triangle with animation

Data Visualization - List of D3.js samples







AngularJS



Introduction

Directives I - ng-app, ng-model, and ng-bind

Directives II - ng-show, ng-hide, and ng-disabled

Directives III - ng-click with toggle()

Expressions - numbers, strings, and arrays

Binding - ng-app, ng-model, and ng-bind

Controllers - global controllers, controller method, and external controllers

Data Binding and Controllers (Todo App)

Todo App with Node

$scope - A glue between javascript (controllers) and HTML (the view)

Tables and css

Dependency Injection - http:fetch json & minification

Filters - lower/uppercase, currenty, orderBy, and filter:query with http.get()

$http - XMLHttpRequest and json file

Module - module file and controller file

Forms

Routes I - introduction

Routes II - separate url template files

Routes III - extracting and using parameters from routes

Routes IV - navigation between views using links

Routes V - details page

AngularJS template using ng-view directive : multiple views

Nested and multi-views using UI-router, ngRoute vs UI-router

Creating a new service using factory

Querying into a service using find()

angular-seed - the seed for AngularJS apps

Token (JSON Web Token - JWT) based auth backend with NodeJS

Token (JSON Web Token - JWT) based auth frontend with AngularJS

Twitter Bootstrap

Online resources - List of samples using AngularJS (Already launched sites and projects)

Meteor Angular App with MongoDB (Part I)

Meteor Angular App with MongoDB (Part II - Angular talks with MongoDB)

Meteor Angular App with MongoDB (Part III - Facebook / Twitter / Google logins)

Scala/Java Play app with Angular

Laravel 5 / Angular Auth using JSON Web Token (JWT) - Prod

Scala/Java Play app with Angular





Node.JS



Node.js

MEAN Stack : MongoDB, Express.js, AngularJS, Node.js

MEAN Stack Tutorial : Express.js with Jade template

Building REST API with Node and MongoDB

Nginx reverse proxy to a node application server managed by PM2

Jade Bootstrap sample page with Mixins

Real-time polls application I - Express, Jade template, and AngularJS modules/directives

Real-time polls application II - AngularJS partial HTML templates & style.css

Node ToDo List App with Mongodb

Node ToDo List App with Mongodb - II (more Angular)

Authentication with Passport

Authentication with Passport 2

Authentication with Passport 3 (Facebook / Twitter Login)

React Starter Kit

Meteor app with React

MEAN Stack app on Docker containers : micro services

MEAN Stack app on Docker containers : micro services via docker-compose





Ruby on Rails



Ruby On Rails Home

Ruby - Input/Output, Objects, Load

Ruby - Condition (if), Operators (comparison/logical) & case statement

Ruby - loop, while, until, for, each, (..)

Ruby - Functions

Ruby - Exceptions (raise/rescue)

Ruby - Strings (single quote vs double quote, multiline string - EOM, concatenation, substring, include, index, strip, justification, chop, chomp, split)

Ruby - Class and Instance Variables

Ruby - Class and Instance Variables II

Ruby - Modules

Ruby - Iterator : each

Ruby - Symbols (:)

Ruby - Hashes (aka associative arrays, maps, or dictionaries)

Ruby - Arrays

Ruby - Enumerables

Ruby - Filess

Ruby - code blocks and yield

Rails - Embedded Ruby (ERb) and Rails html

Rails - Partial template

Rails - HTML Helpers (link_to, imag_tag, and form_for)

Layouts and Rendering I - yield, content_for, content_for?

Layouts and Rendering II - asset tag helpers, stylesheet_link_tag, javascript_include_tag

Rails Project

Rails - Hello World

Rails - MVC and ActionController

Rails - Parameters (hash, array, JSON, routing, and strong parameter)

Filters and controller actions - before_action, skip_before_action

The simplest app - Rails default page on a Shared Host

Redmine Install on a Shared Host

Git and BitBucket

Deploying Rails 4 to Heroku

Scaffold: A quickest way of building a blog with posts and comments

Databases and migration

Active Record

Microblog 1

Microblog 2

Microblog 3 (Users resource)

Microblog 4 (Microposts resource I)

Microblog 5 (Microposts resource II)

Simple_app I - rails html pages

Simple_app II - TDD (Home/Help page)

Simple_app III - TDD (About page)

Simple_app IV - TDD (Dynamic Pages)

Simple_app V - TDD (Dynamic Pages - Embedded Ruby)

Simple_app VI - TDD (Dynamic Pages - Embedded Ruby, Layouts)

App : Facebook and Twitter Authentication using Omniauth oauth2

Authentication and sending confirmation email using Devise

Adding custom fields to Devise User model and Customization

Devise Customization 2. views/users

Rails Heroku Deploy - Authentication and sending confirmation email using Devise

Deploying a Rails 4 app on CentOS 7 production server with Apache and Passenger I

Deploying a Rails 4 app on CentOS 7 production server with Apache and Passenger II

OOPS! Deploying a Rails 4 app on CentOS 7 production server with Apache and Passenger (Trouble shooting)











Contact

BogoToBogo
contactus@bogotobogo.com

Follow Bogotobogo

About Us

contactus@bogotobogo.com

YouTubeMy YouTube channel
Pacific Ave, San Francisco, CA 94115

Pacific Ave, San Francisco, CA 94115

Copyright © 2024, bogotobogo
Design: Web Master