HTML Layouts, Fonts, Styles, Head and Meta
HTML Layouts, Fonts, Styles, Head and Meta
DCIS1204
SEMISTER TWO
YEAR ONE
HTML layout
Note: A website is often divided into headers, menus, content and a footer
HTML layout
Header
A header is usually located at the top of the website (or right below a top navigation menu). It often
contains a logo or the website name:
Navigation Bar
A navigation bar contains a list of links to help visitors navigating through your website By using
HTML nav tag, you can put a group of links in a single semantic element, making your website
more organized.
This element is useful for users navigating the main sections of a website.
Tables of contents and menus are good examples of HTML nav elements.
HTML nav tags can be used in any section of a website.
HTML layout
Example
<nav>
<ul>
<li><a href="https://www.bitdegree.org/tag/interactive-learning">Home</a></li>
<li><a href="#">About us</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</nav>
HTML layout
Content
The layout in this section, often depends on the target users. The most common layout is one (or
combining them) of the following
1-column (often used for mobile browsers)
2-column (often used for tablets and laptops)
3-column layout (only used for desktops)
HTML section tags surround a generic section of the content in a web page or application.
They were introduced in HTML5 and support global attributes.
If you want to group elements to a generic container, use <div> tag instead.
You must use both opening and ending section tags.
The HTML section element, defined by section tags, defines a section of a document, web page, or
an application
HTML layout
Example
<section>
<h1>Section Heading</h1>
<p>The section tag can contain any elements.</p>
<img src="image.png" alt="section example">
</section>
Elements of a section are similar in theme and thus possible to group together logically. For
example, a company's web site might have separate sections for contact information, news, or
special offers.
For identification purposes, HTML sections usually have headings, like <h1>, <h2>, ... <h6>.
Note: HTML5 section is called a semantic element, because the tag defines its content. Such
elements help browsers understand web pages correctly.
HTML layout
HTML footer:
HTML <footer> leaves a footer for its closest sectioning content or root element.
The <footer> HTML element can also be used inside individual blocks in a web document (apart
from web document's main footer content).
<footer> HTML defines a footer in webpages. The <footer> in HTML contains generally repetitive
content like contact details, authors' information, licenses, copyright information, etc.
Example
<footer>
<address>
Postal Address: Door No.00, Street, City, State, Country.
</address>
<p>Copyright © 2018 All rights reserved.</p>
</footer>
HTML style
Example
Set background color for two different elements:
<body>
<h1 style="background-color:powderblue;">This is a heading</h1>
<p style="background-color:tomato;">This is a paragraph.</p>
</body>
Text Color
The CSS color property defines the text color for an HTML element:
Example
<h1 style="color:blue;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>
HTML style
Fonts
The CSS font-family property defines the font to be used for an HTML element:
Example
<h1 style="font-family:verdana;">This is a heading</h1>
<p style="font-family:courier;">This is a paragraph.</p>
Text Size
The CSS font-size property defines the text size for an HTML element:
Example
<h1 style="font-size:300%;">This is a heading</h1>
<p style="font-size:160%;">This is a paragraph.</p>
HTML style
Text Alignment
The CSS text-align property defines the horizontal text alignment for an HTML element:
Example
<h1 style="text-align:center;">Centered Heading</h1>
<p style="text-align:center;">Centered paragraph.</p>
HTML head
The head elements collectively describes the properties of the document such as title, provide meta
information like character set, instruct the browser where to find the style sheets or scripts that
allows you to extend the HTML document in a highly active and interactive ways.
The HTML elements that can be used inside the <head> element are: <title>, <base>, <link>,
<style>, <meta>, <script>
HTML head
Example
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="John Doe">
Setting The Viewport
The viewport is the user's visible area of a web page. It varies with the device - it will be smaller on a mobile phone than
on a computer screen.
You should include the following <meta> element in all your web pages:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
This gives the browser instructions on how to control the page's dimensions and scaling.
The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary
depending on the device).
The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.
Here is an example of a web page without the viewport meta tag, and the same web page with the viewport meta tag: