Getting The Structure and Text Right
Getting The Structure and Text Right
STRUCTURE
AND TEXT RIGHT
Prepared By:
Mary Grace Garces
4 Key Concepts of HTML
1. Elements: all HTML pages are
made up of elements. Think of an
element as a container in which a
portion of a page is placed. Ex:
<h1>Text Here</h1>
2. Tags: is an HTML codes that are
enclosed in angle brackets and are
used to format the text. Ex:<br>
– Often elements and tags are used
interchangeably.
– An element is made up of two tags:
an opening tag and a closing tag.
4 Key Concepts of HTML
3. Attributes and Values:
– Attribute is used to define the
characteristics of an element and is
placed inside the elements opening
tag. Ex: lang attribute of head.
– Values work together with attributes to
complete the definition of an element’s
characteristics.
<html lang=“en”>
lang – is the attribute (refers to language)
en – is the value (refers to English)
4 Key Concepts of HTML
3. Attributes and Values:
– Attribute is used to define the
characteristics of an element and is
placed inside the elements opening
tag. Ex: lang attribute of head.
– Values work together with attributes to
complete the definition of an element’s
characteristics.
<html lang=“en”>
lang – is the attribute (refers to language)
en – is the value (refers to English)
4 Key Concepts of HTML
4. Nesting:
– Often, you will want to apply more than one
element to a portion of your page.
– Nesting simply means that elements must
never overlap.
HTML DOCTYPE
Starts Things Off!
• In any HTML document sits a Document
Type Declaration (DTD), or DOCTYPE
declaration. This line of markup specifies
which version of HTML(or XHTML) you’re
using and also lets browsers know how to
interpret what follows.
HTML Document Organization
• The <html></html> opening and closing tags follow
the DOCTYPE declaration and contain everything else
inside the HTML document.
• The <head></head> follows the opening <html> tag. It
contain definitions, labels, and information about the
HTML document body that follows. The only legal
elements inside the <head> HTML document include
base, link, meta, script, style, and title.
• The <body></body> opening and closing tags follow
the closing </head> tag. They include the content and
related markup for the HTML document. This is where 99
percent of the stuff that actually appears inside a web
browser lives.
The <head> himself
• The head, or header, provides basic
information about the document, including
its title and metadata (information about
information), such as keywords, character
encoding, author information, and a
description.
• If you want to use an external style sheet
within a page, information about that style
sheet also goes into the header.
Handling Metadata
• Metadata means data or information about
data.
• All <meta> elements always appear inside
the HTML <head>, and may be used to
define the character encoding — that is,
the bit level codes used to represent
character data — inside an HTML
document.
• They define keywords for search engines,
describe document content, identify the
document’s author, define a document
refresh interval (the interval at which a page
automatically reloads itself), and more.
<head>
<meta charset=”UTF-8”> <!-- defines default HTML
character codes -->
<meta name=”keywords” content=”HTML, CSS, meta tag
examples”>
<meta name=”author” content=”MGVentura”> <!--
identifies author -->
<meta name=”description” content=”meta element
discussion -->
<meta http-equiv=”refresh” content=”1800”> <!-- refresh
every 30 mins -->
<title>Lots of head markup, no body</title>
</head>
Comments in HTML5
• Comments function as little notes to
yourself.
• Comments are represented through
• <!--Add your Comment Here-->
• Comments are not displayed in the
browser, they are sometimes called non
printing lines.
Control Text Flow
Controlling Text Flow
• Indents, Paragraph Breaks and
Line spacing is a main
consideration when building a
web site.
• HTML provide several means
for indicating breaks in your
paragraph.
<br /> and <p>
• The difference between the line
break and the paragraph
elements is that…
• when you use <br /> you’re
telling a browser to insert a line
break and go to the next line.
• The <p>element on the other
hand, will add a blank line
before it starts your new
paragraph.
Designate Headings with
<h#></h#>
• The purpose of the heading
element is to indicate
different heading levels in a
document.
• The tag are made up of h
with level of 1-6 following it.
One(1) will be the largest and
six(6) will be the smallest
Browser Displays
• ✓ First-level headings (<h1>) are the
largest (usually two or three font sizes
larger than the default text size for
paragraphs).
• ✓ All headings use boldface type by
default, and paragraph text uses plain
(nonbold) type by default.
• ✓ Sixth-level headings (<h6>) are the
smallest and may be two or three font
sizes smaller than the default paragraph
text.
Indent Text
• When you want to indent text in
a word processor, just press
the TAB key.
• In HTML, its NOT that SIMPLE.
• Web browsers ignore normal
text formatting instructions, you
have to be creative to indent
text.
Use to add spaces
• The non breaking space entity
( ) will instruct a browser to
add spaces wherever you want
them.
• It is most commonly used to create
an indent at the beginning of a
paragraph.
• If you want to have a five-space
indent at the beginning of the
paragraph, type five nonbreaking
space entities at the beginning of
the line you want to indent.
Use the Definition Description
Element <dd> to Indent Text
• The definition description
<dd> </dd> element
automatically indents.
• So by enclosing the top line of
your text in this element, you
can force an indent without
typing all those entities.
Use <blockquote> to Indent a
Large Block
• If you want to indent
everything from the left margin,
the easiest way to do it is to use
the <blockquote> </blockquote>
element.
• Keep in mind that when you
enclose your text in this
element, you will instruct the
browser to indent the margins
from both sides.
Preformatted text
• The preformatted text element
(<pre></pre>) instructs
browsers to keep all white
space intact while it displays
your content.
Insert Ruler Lines with <hr />
• The horizontal rule element, <hr />,
will draw a horizontal line wherever you
place it.
• Attributes/Values of <hr /> tag
width:refers to the width of the rule.
It could be based on the percentage of the
screen size or in the number of pixels
(the little “dots” that make up the pictures
on the monitor of your screen.
Example1: <hr width=“200” /> in pixels
Example2: <hr width=“20%”> % of
screen
Attributes of <hr /> Tag
• size: you can specify the thickness
of the rule with the size attribute,
but this time you must use pixels
instead of percentages.
<hr width=“25%” size=“3”>
Attributes of <hr /> Tag
• noshade: Some browsers display a
horizontal rule line with shading that
gives it a 3D look.
• If you prefer your rule to appear as
a solid line, add the noshade
attribute.
<hr width=“25%” size=“3” noshade
color=“blue”>
Attributes of <hr /> Tag
• color: you can choose a color by
adding the color attribute.