HTML Responsive
HTML Responsive
Techniques
HTML Layout Elements
HTML has several semantic elements that define the different parts of a web
page:
• CSS framework
• CSS float property
• CSS flexbox
• CSS grid
<html lang="en">
<head>
<title>CSS Template</title>
<meta charset="utf-8">
<style>
*{
box-sizing: border-box;
body {
font-family: Arial, Helvetica, sans-serif;
header {
background-color: #666;
padding: 30px;
text-align: center;
font-size: 35px;
color: white;
nav {
float: left;
width: 30%;
background: #ccc;
padding: 20px;
nav ul {
list-style-type: none;
padding: 0;
}
article {
float: left;
padding: 20px;
width: 70%;
background-color: #f1f1f1;
section::after {
content: "";
display: table;
clear: both;
footer {
background-color: #777;
padding: 10px;
text-align: center;
color: white;
}
/* Responsive layout - makes the two columns/boxes stack on top of each
other instead of next to each other, on small screens */
nav, article {
width: 100%;
height: auto;
</style>
</head>
<body>
<p>Resize the browser window to see the responsive effect (you will
learn more about this in our next chapter - HTML Responsive.)</p>
<header>
<h2>Cities</h2>
</header>
<section>
<nav>
<ul>
<li><a href="#">London</a></li>
<li><a href="#">Paris</a></li>
<li><a href="#">Tokyo</a></li>
</ul>
</nav>
<article>
<h1>London</h1>
</article>
</section>
<footer>
<p>Footer</p>
</footer>
</body>
</html>
CSS Flexbox Layout
<h2>Computer Code</h2>
<code>
x = 5;
y = 6;
z = x + y;
</code>
Keyboard input
<p>The samp element is used to define sample output from a computer program.</p>
<p>Message from my computer:</p>
<p>The area of a triangle is: 1/2 x <var>b</var> x <var>h</var>, where <var>b</var> is the base, and
<var>h</var> is the vertical height.</p>
In HTML there are some semantic elements that can be used to define
different parts of a web page:
• <article>
• <aside>
• <details>
• <figcaption>
• <figure>
• <footer>
• <header>
• <main>
• <mark>
• <nav>
• <section>
• <summary>
• <time>
• Chapters
• Introduction
• News items
• Contact information
A web page could normally be split into sections for introduction, content,
and contact information.
<section>
<h1>WWF</h1>
</section>
<section>
<p>The Panda has become the symbol of WWF. The well-known panda logo
of WWF originated from a panda named Chi Chi that was transferred from
the Beijing Zoo to the London Zoo in the same year of the establishment of
WWF.</p>
</section>
• Forum posts
• Blog posts
• User comments
• Product cards
• Newspaper articles
HTML <header> Element
The <header> element represents a container for introductory content or a set
of navigational links.
• authorship information
• copyright information
• contact information
• sitemap
• back to top links
• related documents
Tag Description