HTML Structure
HTML Structure
3. HTML Tables
<table>, <thead>, <tbody>, <tr>, <td>
4. HTML Entities
© ® ™ < >
2
Have a Question?
sli.do
#html-softuni
3
HTML Document Structure
HTML Document, Doctype, Head, Body
HTML Document Structure
Essential elements for each HTML document:
<!DOCTYPE>, <html>, <head>, <body>
The <html> element
All the content of the Web page is inside the <html> tag
<!DOCTYPE html>
<html>
…
</html>
5
Head Element
The <head> contains markup not visible to the user
But helps the browser to render correctly the HTML document
<link rel="stylesheet"
Styles declarations type="text/css" href="site.css">
<head>
<title>Home – …</title>
</head>
<link href="/favicon.ico"
rel="shortcut icon" type="image/x-icon"/>
12
HTML5 Semantic Tags: Nav
<nav> – defines a set of navigation links
<nav id="topmenu">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Menu</a></li>
<li><a href="#">Courses</a></li>
</ul>
</nav>
13
Problem: Navigation Bar
Create a HTML page with navigation bar like the shown below
Hints:
Modify the HTML
code from the
previous slide
Write some CSS
14
Solution: Navigation Bar (CSS)
body { nav#topmenu li {
margin: 0; font-size: 24px;
padding: 0; line-height: 40px;
background: #ccc; height: 40px;
} display: inline-block;
nav#topmenu ul { padding: 20px;
list-style: none; }
background-color: #444; nav#topmenu a {
text-align: center; text-decoration: none;
padding: 0; color: #fff;
margin: 0; }
}
Check your solution here: https://judge.softuni.bg/Contests/395 15
HTML5 Semantic Tags: Header
<header> – holds a document or section header
<section>
<h2>Heading</h2>
<img src="bird.jpg" />
</section>
18
Problem: Page Content
Create a HTML
<section>
Holding a few <header>
<article>
elements with
<header> <article>
Like shown on the
screenshot <article>
19
Solution: Page Content (HTML)
<section>
<article>
<header>
<h1>Just another day</h1>
<p>Written by…</p>
</header>
<p>This is my second blog…</p>
</article>
<article>
<!-- TODO: put the next article here -->
</article>
</section>
body { h1 {
margin: 0; font-size: 28px;
padding: 0; }
background: #ccc; header > p {
} font-style: italic;
}
section { article > p {
margin-left: 20px; font-size: 24px;
} }
21
Semantic Tags: Aside
<aside> – defines a sidebar (left / right navigation)
Main site
... content Sidebar:
<aside> <aside>
<h2>Blogroll</h2>
<ul>
<li><a href="#">My Friend</a></li>
<li><a href="#">My Other Friend</a></li>
<li><a href="#">My Best Friend</a></li>
</ul>
</aside>
22
Semantic Tags: Footer
<footer> – a document / section footer
23
Problem: Simple Website
24
Solution: Simple Website (HTML + CSS)
<nav> /* TODO: use the CSS from
<ul> the previous problem */
<li><a href="#">Home</a></li>
<!-- TODO: add the missing links --> footer {
</ul> background: #444;
</nav> color: #fff;
<section> text-align: center;
<article><!-- TODO: use the code }
from prevous problem --></article>
</section> Check your solution here:
<footer> https://judge.softuni.bg/Contests/395
<p>© Copyright 2009 …</p>
</footer>
25
Semantic Tags: Figure + Figcaption
<figure> – element to mark up a photo in a document:
<p>The Pulpit Rock …</p>
Without <figcaption>
<figure>
<img src="img_pulpit.jpg" alt="The …">
</figure>
<figcaption> – a caption for a figure element
<p>The Pulpit Rock …</p>
With <figcaption>
<figure>
<img src="img_pulpit.jpg" alt="The …">
<figcaption>Fig.1 - A view …</figcaption>
</figure>
26
Semantic Tags: Details + Summary
<details> – tag specifies additional details
<details>
<p>More info about the details.</p> expand
</details>
<details>
<summary>Some details</summary>
expand
<p>More info about the details.</p>
</details>
27
Semantic Tags: Time + Address
<time> – a human-readable time
<p>
We open at <time>10:00</time> every morning.
</p>
Columns Rows
colspan="1" colspan="1" rowspan="2" rowspan="1"
<tbody>
<tr>…</tr> <tfoot>
</tbody> <tr>…</tr>
</tfoot>
37
Solution: Exam Results (HTML + CSS)
<table>
<thead>
<tr><th colspan="4">Web Fundamentals</th></tr>
</thead>
<tbody>
<tr>
<td class="bold">№</td>
<!-- TODO: put the rest <td> here … -->
</tr>
<!-- TODO:put the rest <tr> with <td> here … -->
</tbody>
38
Solution: Exam Results (More HTML + CSS)
<tfoot>
<tr><td colspan="4" class="result"><!--TODO:--></td></tr>
</tfoot>
</table>
Incorrect html-tag
<some-Text-example>
<some-Text-example>
40
Summary
HTML document structure:
<!DOCTYPE>,<html>,<head>,<body>
HTML entities:
© ™ < >…
42
HTML Document Structure
? ?
sti on s ?
Qu e
?
?
?
?
?
https://softuni.bg/courses/
License
This course (slides, examples, demos, videos, homework, etc.)
is licensed under the "Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International" license
44
Free Trainings @ Software University
Software University – High-Quality Education,
Profession and Job for Software Developers
softuni.bg
Software University Foundation
softuni.org
Software University @ Facebook
facebook.com/SoftwareUniversity
Software University Forums
forum.softuni.bg