SlideShare una empresa de Scribd logo
1 de 22
HTML



                       HyperText Markup Language

is the main markup language for creating web pages and other information that can be displayed
                                       in a web browser.

                                        abidibo says:
           HTML is not a programming language!
Wait, what the hell is abidibo?

abidibo it's me
●   Physicist
●   Software developer at otto srl (web applications, mobile, databases, ...)
●   Just Open Source
●   Dev questions?
    abidibo@gmail.com
●   Questions about Open Source projects?
    dev@abidibo.net
●   Web: http://abidibo.net
●   Skype: abidibo
●   Twitter: abidibo
HTTP

HyperText Transfer Protocol (HTTP) is the main system used to transmit information over the web
URL (Uniform Resource Locator)
(http://)(www.example.com)(/pages/about.html)
Version (standard) history

●   1989 Tim Berners-Lee invents the Web with HTML as its publishing language
●   1995 HTML 2
●   1997 (january) HTML 3.2
●   1997 (december) HTML 4.0 strict, transitional, frameset, css
●   1999 HTML 4.01
●   2000 XHTML 1.0 XHTML 1.0 is a HTML 4.01 reformulation using XML (doctype, closed tags,
    case-sensitive,...)

●   2001 XHTML 1.1
●   2002-2006 XHTML 2
●   ? HTML5
Elder web sites

●   Nothing more than a collection of html files organized (or not) into folders
●   Url:
    http://www.example.com/index.html
    http://www.example.com/pages/about.html
    Files:
    ROOT DIR → index.html
    ROOT DIR/pages → about.html
●   Almost nothing different from viewing (downloading) a file which resides on a different machine
    which occasionally has links to other files which reside on the same or another machine (plus
    other resources like images, videos, ...).
●   Really a web page is only a file?
    Not only this, is a text file, it contains text, but such text is formatted (html is a markup language)
●   HTML provides a way to jump between different files (HyperText) allowing the user for a contents
    navigation
●   Static web sites, change contents manually by editing the html files
Web 2.0

●   Dynamic web sites, and rich web applications
●   Contents are stored in databases instead of directly into files
●   Contents can be easily managed through back-office interfaces
●   Applications generally implemented using a server side programming language which serves
    the final document (php, python, asp, …)
●   Web sites allow everyone to publish contents on the web, also without html knowledge
    (WYSIWYG editors)
●   “So is it really necessary to learn HTML?”
    YES!
●   “But Joomla, Wordpress, Typo3, Blogspot, Tumblr...”
    Again YES!
●   “But really, my friend has its on website but he doesn't...”
    YESSS!!
Why YES!


●   The final output of a rich web application still is an html document
●   Contents still are the noblest part of a web site.
    Contents are rendered in html
●   BAD JOOMLA BOY SAYS:
    “But we have WYSIWYG!”
    ANSWER:
    “WYSIWYG sure, but what you get often is NOT really what you see”
●   Be cross-browser! (i.e. IE is your enemy)
●   Web applications use templates (HTML) in which they insert dynamic contents
●   The HTML you may write is better than the HTML a software can produce
●   Learning HTML is easy! Learning CSS is easy!
What really does HTML?

●   Text Structure - TAGS
    Separate structure from contents

    Divide contents in blocks, visually separate information

    Nested contents, tree like structure

    What is a tag? <tagname>tag content</tagname> → <structure>content</structure>

●   Semantics!!!!!
    Which is the page title (hopefully not the bold big-sized first line)

    Does a block forms an independent part of a document? Is this list a menu? ...

    Accessibility and Search Engines Optimization

●   Through pages navigation (hyper text)
●   Styles (Graphics)
    Colors, backgrounds, borders, …

●   Some amazing stuff
    If combined with javascript
Text Structure
Text structured in nested elements
<nav>
 <ul>
  <li>Menu voice #1</li>
  <li>Menu voice #2</li>
 </ul>
</nav>

<section id=”main”>
 <h1>Main section</h1>
 <article>
   <h1>title</h1>
   <p>Some text</p>
   <ul>
    <li>Item #1</li>
    <li>Item #2</li>
   </ul>
 </article>
</section>
TAGS 1/2

Generally:
    <tagname attribute=”attribute-value”>tag content</tagname>

Sometimes:
    <tagname attribute=”attribute-value” />

Notice
●   No spaces between < and tagname
●   TagNaMe works the same, but please, be kind, don't do it
●   A tag can contain tags (not every tag can contain every tag, semantics and tag type
    limitations)
●   Attributes specify more information about the content structure
TAGS 2/2

Some examples
 ●   HEAD ELEMENTS
     <title>, <meta>, <link>, <script>, <style>, …
 ●   STRUCTURE OF THE DOCUMENT (semantics!)
     <div>, <p>, <ul>, <ol>, <table>, <h1>, …, <h6>
 ●   TEXT ELEMENTS
     <b>, <i>, <u>, <cite>, <var>, …
 ●   FORM ELEMENTS
     <input>, <select>, <textarea>, <fieldset>, …
 ●   SPECIAL ELEMENTS
     <img>, <video>, <script>, <br />
Try always to use the right tag! <abbr>, <time>, <address>
Reference: https://developer.mozilla.org/en-US/docs/HTML/HTML5/HTML5_element_list
Semantics

1. abidibo.net
  1. Main menu
  2. Archive
  3. Categories
  4. The importance of semantics in html documents
      1. The header and the hgroup tags
      2. The section tag
      3. The article tag
      4. And so on...
      5. Post information
      6. Comments
  5. Projects
  6. Topics
  7. Tweet

  ●    http://www.abidibo.net/blog/2012/01/26/the-importance-of-semantics-in-html-documents/
Styles / Graphics
Tools

Browser                                               Text Editor
   While there are many of them, use a good                 Use you preferred text editor here.
   browser please!                                          Suggestions?
   → NO IE
   → FF                                                     Vim (the editor of the beast)
   → Chrome
   → Safari
   → Opera
                                                      Preview
                                                            http://codepen.io
                                                            http://jsfiddle.net
That's it... but
   There are many other tools/browser plugins which may make you happier, why?
   Time saving,
   don't waste time if you can, play more with your children or drink a beer!

Again, Browser?
   FF → Use Firebug! There's no other web development tool which may be compared to it at the time of this
   writing
Why HTML5?

●   Easier (DOCTYPE, charset declarations)
●   Semantics
●   Multimedia support (no flash plz!)
●   Geolocalization
●   Canvas
●   Forms
●   Storage
●   Mobile
●   Web Sockets
●   ...
Why easier?

    HTML5                          XHTML
●   <!DOCTYPE html>            ●   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
                                   1.0 Strict//EN" "
●   <html>                         http://www.w3.org/TR/xhtml1-strict.dtd">
●   <meta charset=”utf-8” />   ●   <html xmlns="http://www.w3.org/1999/xhtml"
                                   lang="it" xml:lang="it">
●   <script>
                               ●   <meta http-equiv="content-type"
●   <style>                        content="text/html; charset=utf-8" />
                               ●   <script type=”text/javascript”>
                               ●   <style type=”text/css”>
Semantics

●   <section>
●   <article>
●   <aside>
●   <header>
●   <footer>
●   <hgroup>
●   Not only one <h1> for page!
●   Outline
    → http://www.abidibo.net/blog/2012/01/26/the-importance-of-semantics-in-html-documents/

    → http://gsnedders.html5.org/outliner/
Hello world!

HTML5 rulez!                        What?
1. <!DOCTYPE html>                  1 → Document declaration
2. <html>                           2 → Root element
3.   <head>                         3 → Head of the document (include external
                                    resources, add meta information, favicon, )
4.    <meta charset=”utf-8” />
                                    4 → Character encoding
5.    <title>Hello world!</title>
                                    5 → Title of the page (as appears in the
6.   </head>                        browser tab)
7.   <body>                         7 → The body of the document, what we really
8.    <h1>Hello world!</h1>         see on the browser page

9.   </body>                        8 → Just an heading

10. </html>
CSS

Cascading Style Sheets
●   Define how your html elements will be displayed
●   Css can be INLINE
    <span style=”padding: 10px; color: #aaa; display: block”></span>
●   Css can stay in the head of the document
    <head>
     <style>
      span {
        padding: 10px;
        color: #aaa;
        display: block;
      }
     </style>
    </head>
●   Css can stay in a separate file: stylesheet.css and included in the head section

    <link type=”text/css” rel=”stylesheet” href=”stylesheet.css” />
CSS selectors

A simple selector as defined by the CSS3 specs is composed of “either a
type or universal selector followed by zero or more attribute selectors,
ID selectors, or pseudo-classes, in any order.
●   A type selector is used to select elements based on their tag name, such as div or span. A related selector, called a
    universal selector, is denoted by the asterisk symbol (*), and is used to select elements regardless of their tag.
●   An id selector is used to select an element based on the value of its id attribute. Each id attribute in a given
    document must be unique, so the id attribute can only be used to match a single element.
    #item, #wrapper
●   A class selector is used to select elements based on the value of their class attribute. An element can have several
    CSS classes, and a CSS class can be used for more than one element.
    .notification, .colored
●   An attribute selector is used to select elements based on the value of their attributes.
    [<Attribute Name><Operator>"<Value>"].
    The <Attribute Name> refers to an attribute of the element to select
    The <Operator> can be one of the following:
     = (equal to)
     ~= (includes in space list)
     |= (includes in pipe list)
     ^= (starts with)
     $= (ends with)
     *= (contains)
CSS pseudo-selectors

Special selectors that don’t deal with properties, but rather with states
:empty—matches a node with no child nodes.

:first-child—matches a node if it’s the first child of its parent.

:last-child—matches a node if it’s the last child of its parent.

:only-child—matches a node if it has no sibling nodes.

:contains(<text>)—matches a node that contains the string value passed as the

   argument to <text>

:not(<selector>)—matches a node if it doesn’t match the simple selector passed

    as the argument to <selector>

:first-of-type—matches a node if it’s the first element of its type (i.e., a tag).

:last-of-type—matches a node if it’s the last element of its type.

:only-of-type—matches a node if it’s the only element of its type.
CSS combined selectors

Two or more simple selectors that are connected using a
combinator.
A combinator is a special symbol that denotes the
relationship of one simple selector to another
●   div a
    the whitespace character is the descendant combinator
●   div > a
    the greater than symbol is the child combinator
●   div ~ a
    the tilde symbol is the general sibling combinator (div preceeds a)
●   Div + a
    the plus sign is the adjacent sibling combinator

Más contenido relacionado

La actualidad más candente

Introduction to XML, XHTML and CSS
Introduction to XML, XHTML and CSSIntroduction to XML, XHTML and CSS
Introduction to XML, XHTML and CSS
Jussi Pohjolainen
 
網頁程式設計
網頁程式設計網頁程式設計
網頁程式設計
傳錡 蕭
 

La actualidad más candente (20)

HTML & CSS Workshop Notes
HTML & CSS Workshop NotesHTML & CSS Workshop Notes
HTML & CSS Workshop Notes
 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
 
A Primer on HTML 5 - By Nick Armstrong
A Primer on HTML 5 - By Nick ArmstrongA Primer on HTML 5 - By Nick Armstrong
A Primer on HTML 5 - By Nick Armstrong
 
Introduction to WEB HTML, CSS
Introduction to WEB HTML, CSSIntroduction to WEB HTML, CSS
Introduction to WEB HTML, CSS
 
OpenCms Days 2014 - Introducing the 9.5 OpenCms documentation
OpenCms Days 2014 - Introducing the 9.5 OpenCms documentationOpenCms Days 2014 - Introducing the 9.5 OpenCms documentation
OpenCms Days 2014 - Introducing the 9.5 OpenCms documentation
 
An Introduction To HTML5
An Introduction To HTML5An Introduction To HTML5
An Introduction To HTML5
 
Intro to web dev
Intro to web devIntro to web dev
Intro to web dev
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
What is HTML - An Introduction to HTML (Hypertext Markup Language)
What is HTML - An Introduction to HTML (Hypertext Markup Language)What is HTML - An Introduction to HTML (Hypertext Markup Language)
What is HTML - An Introduction to HTML (Hypertext Markup Language)
 
HTML 5 and CSS 3
HTML 5 and CSS 3HTML 5 and CSS 3
HTML 5 and CSS 3
 
CSS
CSSCSS
CSS
 
Introduction to XML, XHTML and CSS
Introduction to XML, XHTML and CSSIntroduction to XML, XHTML and CSS
Introduction to XML, XHTML and CSS
 
Unit 4(it workshop)
Unit 4(it workshop)Unit 4(it workshop)
Unit 4(it workshop)
 
網頁程式設計
網頁程式設計網頁程式設計
網頁程式設計
 
Html5 training
Html5 trainingHtml5 training
Html5 training
 
Web1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSSWeb1O1 - Intro to HTML/CSS
Web1O1 - Intro to HTML/CSS
 
Chapter3
Chapter3Chapter3
Chapter3
 
Unit 2 (it workshop)
Unit 2 (it workshop)Unit 2 (it workshop)
Unit 2 (it workshop)
 
Internet and Web Technology (CLASS-4) [CSS & JS]
Internet and Web Technology (CLASS-4) [CSS & JS] Internet and Web Technology (CLASS-4) [CSS & JS]
Internet and Web Technology (CLASS-4) [CSS & JS]
 
Css.html
Css.htmlCss.html
Css.html
 

Destacado (7)

Consigue El Mejor Smartphone En Linea!
Consigue El Mejor Smartphone En Linea!Consigue El Mejor Smartphone En Linea!
Consigue El Mejor Smartphone En Linea!
 
Unit 3 mitosis
Unit 3 mitosisUnit 3 mitosis
Unit 3 mitosis
 
Introduction to Web Design for Literary Theorists I: Introduction to HTML (v....
Introduction to Web Design for Literary Theorists I: Introduction to HTML (v....Introduction to Web Design for Literary Theorists I: Introduction to HTML (v....
Introduction to Web Design for Literary Theorists I: Introduction to HTML (v....
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
An introduction to html
An introduction to htmlAn introduction to html
An introduction to html
 
01. session 01 introduction to html
01. session 01   introduction to html01. session 01   introduction to html
01. session 01 introduction to html
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 

Similar a Light introduction to HTML

Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5
Ravi Raj
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Erin M. Kidwell
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
MrAbbas
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
MrAbas
 
C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱
NAVER D2
 

Similar a Light introduction to HTML (20)

Drupal7 Theming session on the occassion of Drupal7 release party in Delhi NCR
Drupal7 Theming session on the occassion of  Drupal7 release party in Delhi NCRDrupal7 Theming session on the occassion of  Drupal7 release party in Delhi NCR
Drupal7 Theming session on the occassion of Drupal7 release party in Delhi NCR
 
Web Information Systems Html and css
Web Information Systems Html and cssWeb Information Systems Html and css
Web Information Systems Html and css
 
Chapter 2 introduction to html5
Chapter 2 introduction to html5Chapter 2 introduction to html5
Chapter 2 introduction to html5
 
HTML course.ppt
HTML course.pptHTML course.ppt
HTML course.ppt
 
Html5.pptx
Html5.pptxHtml5.pptx
Html5.pptx
 
Is it time to start using HTML 5
Is it time to start using HTML 5Is it time to start using HTML 5
Is it time to start using HTML 5
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
Girl Develop It Cincinnati: Intro to HTML/CSS Class 1
 
HTML & CSS.ppt
HTML & CSS.pptHTML & CSS.ppt
HTML & CSS.ppt
 
Frontend for developers
Frontend for developersFrontend for developers
Frontend for developers
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
 
An-Introduction-to-HTML
An-Introduction-to-HTMLAn-Introduction-to-HTML
An-Introduction-to-HTML
 
C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱
 
Html
HtmlHtml
Html
 
Html5 basics
Html5 basicsHtml5 basics
Html5 basics
 
HTML 5
HTML 5HTML 5
HTML 5
 
Lesson 1: Introduction to HTML
Lesson 1: Introduction to HTMLLesson 1: Introduction to HTML
Lesson 1: Introduction to HTML
 
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
 
Web Concepts - an introduction - introduction
Web Concepts - an introduction - introductionWeb Concepts - an introduction - introduction
Web Concepts - an introduction - introduction
 
Html 5 - What's new?
Html 5 - What's new?Html 5 - What's new?
Html 5 - What's new?
 

Último

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Light introduction to HTML

  • 1. HTML HyperText Markup Language is the main markup language for creating web pages and other information that can be displayed in a web browser. abidibo says: HTML is not a programming language!
  • 2. Wait, what the hell is abidibo? abidibo it's me ● Physicist ● Software developer at otto srl (web applications, mobile, databases, ...) ● Just Open Source ● Dev questions? abidibo@gmail.com ● Questions about Open Source projects? dev@abidibo.net ● Web: http://abidibo.net ● Skype: abidibo ● Twitter: abidibo
  • 3. HTTP HyperText Transfer Protocol (HTTP) is the main system used to transmit information over the web URL (Uniform Resource Locator) (http://)(www.example.com)(/pages/about.html)
  • 4. Version (standard) history ● 1989 Tim Berners-Lee invents the Web with HTML as its publishing language ● 1995 HTML 2 ● 1997 (january) HTML 3.2 ● 1997 (december) HTML 4.0 strict, transitional, frameset, css ● 1999 HTML 4.01 ● 2000 XHTML 1.0 XHTML 1.0 is a HTML 4.01 reformulation using XML (doctype, closed tags, case-sensitive,...) ● 2001 XHTML 1.1 ● 2002-2006 XHTML 2 ● ? HTML5
  • 5. Elder web sites ● Nothing more than a collection of html files organized (or not) into folders ● Url: http://www.example.com/index.html http://www.example.com/pages/about.html Files: ROOT DIR → index.html ROOT DIR/pages → about.html ● Almost nothing different from viewing (downloading) a file which resides on a different machine which occasionally has links to other files which reside on the same or another machine (plus other resources like images, videos, ...). ● Really a web page is only a file? Not only this, is a text file, it contains text, but such text is formatted (html is a markup language) ● HTML provides a way to jump between different files (HyperText) allowing the user for a contents navigation ● Static web sites, change contents manually by editing the html files
  • 6. Web 2.0 ● Dynamic web sites, and rich web applications ● Contents are stored in databases instead of directly into files ● Contents can be easily managed through back-office interfaces ● Applications generally implemented using a server side programming language which serves the final document (php, python, asp, …) ● Web sites allow everyone to publish contents on the web, also without html knowledge (WYSIWYG editors) ● “So is it really necessary to learn HTML?” YES! ● “But Joomla, Wordpress, Typo3, Blogspot, Tumblr...” Again YES! ● “But really, my friend has its on website but he doesn't...” YESSS!!
  • 7. Why YES! ● The final output of a rich web application still is an html document ● Contents still are the noblest part of a web site. Contents are rendered in html ● BAD JOOMLA BOY SAYS: “But we have WYSIWYG!” ANSWER: “WYSIWYG sure, but what you get often is NOT really what you see” ● Be cross-browser! (i.e. IE is your enemy) ● Web applications use templates (HTML) in which they insert dynamic contents ● The HTML you may write is better than the HTML a software can produce ● Learning HTML is easy! Learning CSS is easy!
  • 8. What really does HTML? ● Text Structure - TAGS Separate structure from contents Divide contents in blocks, visually separate information Nested contents, tree like structure What is a tag? <tagname>tag content</tagname> → <structure>content</structure> ● Semantics!!!!! Which is the page title (hopefully not the bold big-sized first line) Does a block forms an independent part of a document? Is this list a menu? ... Accessibility and Search Engines Optimization ● Through pages navigation (hyper text) ● Styles (Graphics) Colors, backgrounds, borders, … ● Some amazing stuff If combined with javascript
  • 9. Text Structure Text structured in nested elements <nav> <ul> <li>Menu voice #1</li> <li>Menu voice #2</li> </ul> </nav> <section id=”main”> <h1>Main section</h1> <article> <h1>title</h1> <p>Some text</p> <ul> <li>Item #1</li> <li>Item #2</li> </ul> </article> </section>
  • 10. TAGS 1/2 Generally: <tagname attribute=”attribute-value”>tag content</tagname> Sometimes: <tagname attribute=”attribute-value” /> Notice ● No spaces between < and tagname ● TagNaMe works the same, but please, be kind, don't do it ● A tag can contain tags (not every tag can contain every tag, semantics and tag type limitations) ● Attributes specify more information about the content structure
  • 11. TAGS 2/2 Some examples ● HEAD ELEMENTS <title>, <meta>, <link>, <script>, <style>, … ● STRUCTURE OF THE DOCUMENT (semantics!) <div>, <p>, <ul>, <ol>, <table>, <h1>, …, <h6> ● TEXT ELEMENTS <b>, <i>, <u>, <cite>, <var>, … ● FORM ELEMENTS <input>, <select>, <textarea>, <fieldset>, … ● SPECIAL ELEMENTS <img>, <video>, <script>, <br /> Try always to use the right tag! <abbr>, <time>, <address> Reference: https://developer.mozilla.org/en-US/docs/HTML/HTML5/HTML5_element_list
  • 12. Semantics 1. abidibo.net 1. Main menu 2. Archive 3. Categories 4. The importance of semantics in html documents 1. The header and the hgroup tags 2. The section tag 3. The article tag 4. And so on... 5. Post information 6. Comments 5. Projects 6. Topics 7. Tweet ● http://www.abidibo.net/blog/2012/01/26/the-importance-of-semantics-in-html-documents/
  • 14. Tools Browser Text Editor While there are many of them, use a good Use you preferred text editor here. browser please! Suggestions? → NO IE → FF Vim (the editor of the beast) → Chrome → Safari → Opera Preview http://codepen.io http://jsfiddle.net That's it... but There are many other tools/browser plugins which may make you happier, why? Time saving, don't waste time if you can, play more with your children or drink a beer! Again, Browser? FF → Use Firebug! There's no other web development tool which may be compared to it at the time of this writing
  • 15. Why HTML5? ● Easier (DOCTYPE, charset declarations) ● Semantics ● Multimedia support (no flash plz!) ● Geolocalization ● Canvas ● Forms ● Storage ● Mobile ● Web Sockets ● ...
  • 16. Why easier? HTML5 XHTML ● <!DOCTYPE html> ● <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " ● <html> http://www.w3.org/TR/xhtml1-strict.dtd"> ● <meta charset=”utf-8” /> ● <html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it"> ● <script> ● <meta http-equiv="content-type" ● <style> content="text/html; charset=utf-8" /> ● <script type=”text/javascript”> ● <style type=”text/css”>
  • 17. Semantics ● <section> ● <article> ● <aside> ● <header> ● <footer> ● <hgroup> ● Not only one <h1> for page! ● Outline → http://www.abidibo.net/blog/2012/01/26/the-importance-of-semantics-in-html-documents/ → http://gsnedders.html5.org/outliner/
  • 18. Hello world! HTML5 rulez! What? 1. <!DOCTYPE html> 1 → Document declaration 2. <html> 2 → Root element 3. <head> 3 → Head of the document (include external resources, add meta information, favicon, ) 4. <meta charset=”utf-8” /> 4 → Character encoding 5. <title>Hello world!</title> 5 → Title of the page (as appears in the 6. </head> browser tab) 7. <body> 7 → The body of the document, what we really 8. <h1>Hello world!</h1> see on the browser page 9. </body> 8 → Just an heading 10. </html>
  • 19. CSS Cascading Style Sheets ● Define how your html elements will be displayed ● Css can be INLINE <span style=”padding: 10px; color: #aaa; display: block”></span> ● Css can stay in the head of the document <head> <style> span { padding: 10px; color: #aaa; display: block; } </style> </head> ● Css can stay in a separate file: stylesheet.css and included in the head section <link type=”text/css” rel=”stylesheet” href=”stylesheet.css” />
  • 20. CSS selectors A simple selector as defined by the CSS3 specs is composed of “either a type or universal selector followed by zero or more attribute selectors, ID selectors, or pseudo-classes, in any order. ● A type selector is used to select elements based on their tag name, such as div or span. A related selector, called a universal selector, is denoted by the asterisk symbol (*), and is used to select elements regardless of their tag. ● An id selector is used to select an element based on the value of its id attribute. Each id attribute in a given document must be unique, so the id attribute can only be used to match a single element. #item, #wrapper ● A class selector is used to select elements based on the value of their class attribute. An element can have several CSS classes, and a CSS class can be used for more than one element. .notification, .colored ● An attribute selector is used to select elements based on the value of their attributes. [<Attribute Name><Operator>"<Value>"]. The <Attribute Name> refers to an attribute of the element to select The <Operator> can be one of the following: = (equal to) ~= (includes in space list) |= (includes in pipe list) ^= (starts with) $= (ends with) *= (contains)
  • 21. CSS pseudo-selectors Special selectors that don’t deal with properties, but rather with states :empty—matches a node with no child nodes. :first-child—matches a node if it’s the first child of its parent. :last-child—matches a node if it’s the last child of its parent. :only-child—matches a node if it has no sibling nodes. :contains(<text>)—matches a node that contains the string value passed as the argument to <text> :not(<selector>)—matches a node if it doesn’t match the simple selector passed as the argument to <selector> :first-of-type—matches a node if it’s the first element of its type (i.e., a tag). :last-of-type—matches a node if it’s the last element of its type. :only-of-type—matches a node if it’s the only element of its type.
  • 22. CSS combined selectors Two or more simple selectors that are connected using a combinator. A combinator is a special symbol that denotes the relationship of one simple selector to another ● div a the whitespace character is the descendant combinator ● div > a the greater than symbol is the child combinator ● div ~ a the tilde symbol is the general sibling combinator (div preceeds a) ● Div + a the plus sign is the adjacent sibling combinator