Lukáš Bařinka
HTML = HyperText Markup Language
WHATWG = Web Hypertext Application Technology Working Group (2004)
html a v něm elementy
head - hlavička dokumentu (metadata)body - tělo dokumentu (data/obsah)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>My first HTML document</TITLE>
<LINK href="special.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<P class="special">Hello world! <˚))))><
<!-- Add more content here -->
</BODY>
</HTML>
Hello world! <˚))))><
<a><b></a></b><dl compact="compact"><hr />, <br />, <img ... /> scipt/style v <![CDATA[...]]>
<!ENTITY % flow "%block; | %inline;">
<!ENTITY % block
"P | %heading; | %list; | %preformatted; |
DL | DIV | NOSCRIPT | BLOCKQUOTE | FORM |
HR | TABLE | FIELDSET | ADDRESS">
<!ENTITY % inline
"#PCDATA | %fontstyle; | %phrase; |
%special; | %formctrl;">
divspanh1, h2, h3, h4, h5, h6p, blockquoteform, fieldsetol, ul, dltablepreaddress autor, osoba zodpovědná za obsahhrem, strong, qdfn, cite, abbr, acronymkbd, samp, var, codeinput, select, textarea, label, buttona, mapimg, objectbr, bdo, sub, suptt, i, b, big, small nepoužívatid, class, style, titlelang, dironclick, on...a) hypertextu propojující zdroj a cíl
hrefname elementu typu a neboid libovolného typu elementuid a name jsou case-sensitive a sdílí společný prostor unikátních hodnotlink nezobrazují se v obsahu dokumenturel a revimg/object, form, …
<H1>Table of Contents</H1>
<P><A href="#section1">Introduction</A><BR>
<A href="#section2">Some background</A><BR>
<A href="#section2.1">On a more personal note</A><BR>
...the rest of the table of contents...
...the document body...
<H2><A name="section1">Introduction</A></H2>
...section 1...
<H2><A name="section2">Some background</A></H2>
...section 2...
<H3><A name="section2.1">On a more personal note</A></H3>
...section 2.1...
<H1>Table of Contents</H1>
<P><A href="#section1">Introduction</A><BR>
<A href="#section2">Some background</A><BR>
<A href="#section2.1">On a more personal note</A><BR>
...the rest of the table of contents...
...the document body...
<H2 id="section1">Introduction</H2>
...section 1...
<H2 id="section2">Some background</H2>
...section 2...
<H3 id="section2.1">On a more personal note</H3>
...section 2.1...
ahreflang = langcode jazyk cílového dokumenturel = link-types vztah dokumetu k cílitype = content-type mime-typ cíletitle = popis cíle (tooltip) nebo pojmenování alternativního stylu (link)download = jméno cílového souboru stažení místo zobrazeníul = Unordered list (prvky k zobrazení)menu = Unordered list/Toolbar (prvky akce)li = List item (položka)ol = Ordered listli = List item (položka)dl = Definition listdt = Definition term (pojem/klíč)dd = Definition description (vysvětlení/hodnota)
<DL>
<DT>Hacker
<DD>a clever programmer
<DT>Nerd
<DD>technically bright but socially inept person
</DL>
<dl>
<div>
<dt> Last modified time </dt>
<dd> 2004-12-23T23:33Z </dd>
</div>
<div>
<dt> Recommended update interval </dt>
<dd> 60s </dd>
</div>
<div>
<dt> Authors </dt>
<dt> Editors </dt>
<dd> Robert Rothman </dd>
<dd> Daniel Jackson </dd>
</div>
</dl>
<UL>
<LI> ... first list item...
<LI> ... second list item...
...
</UL>
<ol start="10">
<li> ... first list item...
<li value="15"> ... second list item...
...
</ol>
<menu>
<li><button onclick="copy()"><img src="copy.svg" alt="Copy"></button></li>
<li><button onclick="cut()"><img src="cut.svg" alt="Cut"></button></li>
<li><button onclick="paste()"><img src="paste.svg" alt="Paste"></button></li>
</menu>
imgaltaltalt=""altimg prázdný element
src určuje zdroj obrázku (soubor)alt určuje alternativní zobrazení (text)
<div class="figure">
<img src="images/dinosaur.jpg"
alt="The head and torso of a dinosaur skeleton;
it has a large head with long sharp teeth"
width="400"
height="341">
<p class="figcaption">A T-Rex on display in the … Museum.</p>
</div>
<figure>
<img src="images/dinosaur.jpg"
alt="The head and torso of a dinosaur skeleton;
it has a large head with long sharp teeth"
width="400"
height="341">
<figcaption>A T-Rex on display in the … Museum.</figcaption>
</figure>
srcset (elementu typu img),
w volitelně, určuje šířku a nebox volitelně, hustotu pixelů (pixel density)
<img src="image-small.png"
srcset="image-small.png 320w, image-medium.png 800w, image-large.png 1200w"
alt="Image description">
<img src="image-defaultdpi.png"
srcset="image-hidpi.png 2x, image-higherdpi.png 4x"
alt="Image description">
picturesource se srcsetimg bez srcset
<picture>
<source type="image/svg+xml" srcset="pyramid.svg">
<source type="image/webp" srcset="pyramid.webp">
<img src="pyramid.png" alt="regular pyramid built from …">
</picture>
<picture>
<source
media="(orientation: landscape)"
srcset="image-small.png 320w,
image-medium.png 800w,
image-large.png 1200w"
sizes="(min-width: 60rem) 80vw,
(min-width: 40rem) 90vw,
100vw">
<source
media="(orientation: portrait)"
srcset="image-small-portrait.png 160w,
image-medium-portrait.png 400w,
image-large-portrait.png 600w"
sizes="(min-width: 60rem) 80vw,
(min-width: 40rem) 90vw,
100vw">
<img src="image-small.png" alt="Image description">
</picture>
objectdata — adresa zdroje (URL)type — MIME-Type zdroje
<object type="image/svg+xml" data="images/object.svg">
<img src="images/object.png" alt="…">
</object>
Tabulka logicky strukturuje data do řádků/sloupců
table data člení na řádkytr jsou členěny na buňkyth nebo data td
colspan nebo řádků rowspancaption
tablesummary
<TABLE summary="This table gives some statistics
about fruit flies: average height
and weight, and percentage with
red eyes.">
<CAPTION>A test table with merged cells</CAPTION>
<TR><TH rowspan="2"><TH colspan="2">Average
<TH rowspan="2">Red<BR>eyes
<TR><TH>height<TH>weight
<TR><TH>Males<TD>1.9<TD>0.003<TD>40%
<TR><TH>Females<TD>1.7<TD>0.002<TD>43%
</TABLE>
| Average | Red eyes | ||
|---|---|---|---|
| height | weight | ||
| Males | 1.9 | 0.003 | 40% |
| Females | 1.7 | 0.002 | 43% |
Řádky tabulky je možné seskupit do částí
thead Záhlaví tabulkytfoot Zápatí tabulkytbody Část tabulky
<table>
<thead><tr> header information </thead>
<tfoot><tr> footer information </tfoot>
<tbody><tr> first row of block one data
<tr> second row of block one data
</tbody>
<tbody><tr> first row of block two data
<tr> second row of block two data
<tr> third row of block two data
</tbody>
</table>
Tabulku lze horizontálně členit na sloupce,
resp. jejich skupiny
colgroup
span nebocolgroup (obsahuje jednotlivé elementy col)col
<colgroup span="40" width="20"></colgroup>
<colgroup>
<col width="20">
<col width="20">
...a total of forty col elements...
</colgroup>
<colgroup width="20">
<col span="39">
<col id="format-me-specially">
</colgroup>
<table>
<colgroup span="10" width="50">
<colgroup span="5" width="0*">
<thead>
<tr><td> ...
</table>
Dobrý návrh tabulky je klíčový pro
lepší čitelnost a použitelnost
<th scope="row/rowgroup">) a sloupců (<th scope="col/colgroup">) a příslušnosti buňky k nim (<td headers="id-col id-row">)th a vizuálně odlišně od tdrole="presentation"3 různé problémy:
meta elementu
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
<meta charset="utf-8"/>
lang nebo xml:langhreflang elementu typu anapř. pro CSS selektoryContent-LanguageProblém s elementem typu title