Web Technologies

HTML

Claudia Chiriță . 2026/2027

https://html.spec.whatwg.org/

HTML = HyperText Markup Language

  • markup language used for
    • defining the structure
    • describing the content
  • of a web page

HTML documents

  • contain elements (tags) that describe different types of content: paragraphs, anchors, lists, images, tabels
  • browsers interpret elements and display HTML documents graphically

HTML documents

  • can be written using any text editor
  • they have the htm or html extensions

HTML elements

  <tag>   content   </tag>
opening tag                         closing tag


they are not case sensitive (<tag>, <TAG>, <tAg>)

HTML elements

  • with content - have opening and closing tags
    eg. <p> a paragraph on platypuses </p>
  • without content - only have opening tags
    eg. <br>, <hr>, <img>, <link>, <meta>

structure of an HTML document

HTML Document = tree of elements
DOM = Document Object Model

Nesting

HTML elements must be correctly nested

<p><b> incorrectly nested </p></b>
<p><b> correctly nested </b></p>

Nesting


https://validator.w3.org/

flow content

Block elements

  • begin and end with a new line and they occupy the entire width of their parent element
  • may contain other block or inline elements
  • in HTML5 correspond to the flow content category
  • eg: <p>, <div>, <h1>-<h6>

Block elements

Inline elements

  • occupy only the space reserved for the element, without occupying the entire width of their parent
  • do not necessarily start with a new line
  • may contain other inline elements
  • in HTML5 correspond to the phrasing content category
  • eg: <span>, <img>, <a>

Inline elements

Attributes

  • HTML elements can have attributes
  • attributes specify additional information associated to an element

name-attribute="value"

Attributes

  • global (can be associated to any element)

    ...

  • specific to a certain element
    href is an attribute for elements a, link
    src is an attribute for elements img, iframe

    an image

The history of HTML

  • HyperText Markup Language (HTML)
    Tim Berners-Lee, 1989, CERN
  • Extensible Markup Language (XML)
    W3C, 1996
  • HTML4 (1997); XHTML(2000)
  • HTML5 (2012)

HTML5

  • HTML Living Standard
  • HTML specification = living document, without a version number since 2011
  • adds multimedia tags: <video>, <audio>
  • adds graphical tags: <svg>, <canvas>

HTML5

  • enriches the semantic content through new structural elements :
    <main>, <section>, <article>, <header>, <footer>, <aside>, <figure>, <figcaption>, ...

Structure of an HTML document


<!DOCTYPE html> 
<html lang="en">  
<head>      
     <meta charset="utf-8"> 
     <title> title of the document </title>
       ...
</head>
<body> 
    
</body>
</html>
          

Semantic Web

Web 3.0

“ Web pages are designed to be read by people, not machines. The semantic web is a vision of information that can be readily interpreted by machines, so machines can perform more of the tedious work involved in finding, combining, and acting upon information on the web. ”

Semantic HTML

“ Semantic HTML is the use of HTML markup to reinforce the semantics, or meaning, of the information in webpages rather than merely to define its presentation or look. ”

Semantics

“ Elements, attributes, and attribute values in HTML are defined (by this specification) to have certain meanings (semantics). ... Authors must not use elements, attributes, or attribute values for purposes other than their appropriate intended semantic purpose, as doing so prevents software from correctly processing the page. ”

Semantic elements

  • clearer structure of the HTML document
  • optimal evaluation for the search engines (SEO)
  • web pages can be better understood by different apps (eg. text-to-speech apps)

<header>, <nav>, <main>, <article>
<section>, <aside>, <footer>

semantic vs non-semantic structuring

<header></header>
<section>
   <article>
      <figure>
         <img>
         <figcaption></figcaption>
      </figure>
   </article>
</section>
<footer></footer>

<div id="header"></div>
<div class="section">
   <div class="article">
      <div class="figure">
         <img>
         <div class="figcaption"></div>
      </div>
   </div>
</div>
<div id="footer"></div>

Heading elements

  • h1, ..., h6 - for structuring the document
  • 1 most important, 6 least important
  • implicit style: bold and larg text
  • used by search engines for indexing page content
  • mark the titles of the sectioning elements article, section, nav, aside

Heading elements

article element

<article> content of the article </article>

  • element with meaningful content, can be used independently from the rest of the website
  • each <article> element must be identified by a title (<h1> - <h6> element)

article element

<article> content of the article </article>

  • has no visual effect
  • eg: a forum post, an online magazine article,
    a blog entry

section element

<section> content of the section </section>

  • defines a generic section of a document, with a clear but suboordinated topic to the general topic of the document
  • the topic mist be indicated through a title
    (<h1> - <h6> element)
  • has no visual effect
  • eg: chapters of a book

sections with articles

article with sections

nav element

<nav> navigation elements </nav>

  • represents a portion of a page with hyperlinks
  • marks important navigation blocks
  • groups links that can appear in footer or header elements

nav element

aside element

<aside> content </aside>

  • represents a portion of the page with tangent content to the content of the page
  • eg: used for ads

aside element

header element

<header> content </header>
  • introductory content for a page or an element (section, article)
  • usually contains a heading h1,...,h6

footer element

<footer> content </footer>
  • additional content on the closest sectioning element
  • eg. author, copyright
  • may contain an address element with contact details of the author

main element

<main> content </main>
  • the actual content of the page
  • there can only exist one main in a page

strong, em, small semantic elements

<strong> important text, warning </strong>
<em> highlighted text  </em>
<small> additional comments </small>

strong, em, small semantic elements

strong, em, small semantic elements

the elements b (bold), i (italic) became semantic as well starting with HTML5

<b> keywords </b>
<i> scientific terms / words in another language
    / alternative text </i>

p and hr elements

<p> represents a paragraph (text fragment highlighting an idea)

<hr> represents a thematic break between groups of paragraphs

div and span elements

<div> content </div>
<span> content </span>
  • <div>, <span> do not have a special meaning
  • used for styling, usually with attributes id and class
  • a new line before <div> and after </div>

br element

<br> for breaking the line 
  • not used to mark the begining of a new idea
  • the lyrics of a
    poem, the components of a
    postal addresse

Unordered lists

<ul> a list in which the order of the elements (items) 
     is not relevant
<li> used to create the elements of a list

Ordered lists

<ol> a list in which the order of the elements is important 

specific attributes: type, start, reversed

Description lists

<dl>, <dt>, <dd>  

a element - anchor, hyperlink

<a href="URL"> content </a>
  • refernce to a resource
  • attributes:
    • href: the destination of the link (an URL or id of an element on the page)
    • download: downloading the target resource (instead of visualising it)
    • target = the way in which the target resource is loaded in the browser
      _blank | _parent | _self | _top| framename
  • internal links = links to a page fragment
    <a href="#id-menu"> link to the menu
    ...
    
            

a element - anchor, hyperlink

img element

<img src="image-address" alt="descriptive-text">
  • src and alt attributes are mandatory
  • alt = alternative text which will be displayed if the image cannot be processed
  • attributes width and height for specifying the dimension in pixels
  • accepted formats: PNG, GIF, JPEG, PDF, XML, APNG, SVG, MNG

img element

figure and figcaption elements

<figure>
  <img src="image-address" alt="descriptive-text">
  <figcaption> Figure 1. Description </figcaption>
</figure>
  • figure, together with figcaption, form an element on its own (flow content)
  • can be used with other elements, like
    <pre>, <code> and <video>

figure and figcaption elements

audio and video elements

<audio src="URL-audio" controls> message </audio>
<video src="URL-video" controls autoplay> message </video>
<video src="URL-video" controls poster="URL-img"> message </video>
  • poster: the image will be displayed when the video element can't be played
  • several alternative sources can be given in child elements of type <source>

iframe element

<iframe src="URL" width="n1" height="n2"> text displayed 
if the website can't be embedded </iframe>

embedding a page inside the current page

Tabels

used only for representing data
NOT for defining the layout of a page

<table> the content of the tabel, line by line </table>
<caption> the description of the tabel (optional) </caption>
<tr> line comprising cells </tr> 
<td> data cell </td>
<th> header cell  </th>      
       

Tabels

Tabels

  • for defining tabels we can also use the elements
    thead, tbody, tfoot, colgroup, col
  • specific attributes for td and th: colspan & rowspan
    for cells that take up more columns/lines

          
                                        ,=.
                          ,=""""==.__.="  o".___
                    ,=.=="                  ___/
              ,==.,"    ,          , \,===""
             <     ,==)  \"'"=._.==)  \
              `==''    `"           `"
              
                         questions?