etsu logo

CSCI 1210

Essentials of Web Development

Essentials of Web Design

CSCI 1210


HTML5 Semantic Elements

(& Information Architecture ... & Navigation)


Today's Lecture

HTML Semantics

Information Architecture

CSS Pseudo-classes

Making a Nav Bar

Semantics

The study of the meanings of words and phrases in language

'Semantic Elements' are elements that have meaning

Clearly describes meaning to both the browser and the developer

Non-semantic: <div> & <span> tell nothing about what they contain

Semantic: <form>, <table>, & <img> clearly define their content

HTML 5 Semantic Elements

HTML 5 includes semantic elements, which define different parts of a web page

<header>

<nav>

<section>

<article>

<aside>

<footer>

screen shot

Header

The <header> element creates a header for a document, section, or article

Should be used as a container for introductory content

A page may (or may not) have several <header> elements

Nav

The <nav> element creates a set of navigation links

The <nav> is typically used for nav links internal to the site

Not all links in a document will be placed inside a <nav> element!

<nav> is specifically for intra-site links; absolute links (to resources outside of a site) should be styled differently

screen shot
screen shot

Section

The <section> element creates a section (division) in a document

According to W3C's HTML5 documentation: "A section is a thematic grouping of content, typically with a heading"

A Web site's home page could be split into sections for introduction, content, and contact information

Section

A page may be divided into a number of sections, each with a logical theme

Alternatively, a page may have one section with a number of headers that divide them logically

screen shot

Article

The <article> element specified independent, self-contained content

An article should make sense on its own, and it should be possible to read it independently from the rest of the web site

Examples of where an <article> element can be used:

Forum post

Blog post

Newspaper article

Article

An <article> can be used in a similar fashion as a section, with similar properties

screen shot

Aside

The <aside> element defines some content that is related to, but not directly, the site's overall content

This is typically a sidebar-kind of element

May be a set of <nav> elements, a calendar, an RSS feed, or anything else that may be of interest to a user

screen shot

Footer

Well, a <footer> element is located at the end, or bottom, of a document or section

Should contain information about its containing element

Author, copyright © information, links to terms of use and/or privacy information, etc.

A document may (or may not) have several footer elements

Nesting Semantic Elements

In the HTML 5 standard, the <article> element defines a complete, self-contained block of related elements

The <section> element is also defined as a block of related elements

So, can we use these definitions to decide how to nest elements?

NO! We cannot!

Nesting Semantic Elements

On the Internet, you will find HTML pages with <section> elements containing <article> elements, and <article> elements containing <section> elements

You will also find pages with <section> elements containing <section> elements, and <article> elements containing <article> elements

As a designer, you should pick what structure / nesting scheme best fits your content and be consistent in using it

However, it may be decided by the organization you're employed by

Nesting Semantic Elements

Newspaper vs Academic Journal

Newspaper - Several sections (i.e., Headline News, Sports, Local, Entertainment, etc)

Each 'section' has one or more articles about its topic

Articles typically include content such as headings/headers, text, images, tables, an even (sometimes) asides

Nesting Semantic Elements

Newspaper vs Academic Journal

Academic Journal: A single publication with a number of articles about a topic of interest

Each article (tends to) be rather lengthy

Often divided into sections: Abstract, Introduction, Literature Review, Hypothesis, Methodology, Results, Conclusion, Bibliography

Each section includes text (content), images, tables, figures, lists, etc

Nesting Semantic Elements

screen shot

Nesting Semantic Elements

screen shot

Why Semantic Elements?

With HTML 4, developers tended to use their own, custom, favorite, attribute names to style page elements

header, top, bottom, footer, menu, container, content, article, sidebar, topnav, ...

This practice made it impossible for search engines to identify the web content

With HTML 5, elements like <header>, <footer>, <nav>, <section>, & <article>, this becomes easier for search engines to better index web sites

Why Semantic Elements?

Addording to the W3C, a Semantic Web

Allows data to be shared and reused across applications, enterprises, and communities

HTML 5 Semantic Elements

IE8 (and below) does not 'play nice' with the new HTML 5 elements. In order to use them, you need to

Download the html5shiv.js JavaScript file

Add the following lines of code to the <head> element


HTML 5 Semantic Elements

screen shot

From Bootstrap framework head element. Allows use of the shiv without having to download it
- cdn == Content Delivery Network

HTML 5 Semantic Elements

Older browsers may not recognize the new elements as block level container elements. Will need to add the following to your CSS:

header, section, footer, aside, nav, article, {
     display: block;
}

HTML 5 Semantic Elements

screen shot

Information Architecture &
Site Navigation

Information Architecture

Science of figuring out what site should contain & how it can best be organized and presented

Two primary elements

Organizing and labeling site content

Designing navigation through information

screen shot

Information Architecture

The more work done early, less rework to do

Challenging to take a large amount of data and make it easy to understand and navigate

Organize information - structure

Information grows and changes over time - good structure enables this

You have to plan ahead to make a site maintainable

User's Mental Model

Users make a quick assessment of a site when they land on it to understand how it is organized and what it contains

If too much is presented, or it is poorly organized, the user will feel overwhelmed and/or confused

Overwhelmed/confused users typically bounce

User's Mental Model

If too little is presented, the user may feel bored and decide that little value is present

If the user doesn't feel 'in control' or have understanding of site structure, will tend to leave

We must think about navigation and organization of site like the user does

'Putting yourself in the user's shoes' is a critical skill for a developer

screen shot
screen shot
screen shot
screen shot
screen shot

Information Architecture Process

Decide what information elements and functional content site must provide

Decide how above can best be grouped and organized

Plan connecting navigation among elements

Information Architecture Process

Create succcinct, descriptive terms that can be used to guide navigation

Think like a user, not a developer

Evaluate and improve resulting proposed structure

How we organize content is just as important as the content itself, if not more so

Critical IA Issues

Labels and naming

What are things called? Be consistent to avoid confusion

Clarity & simplicity

Structure of content

What goes where?

What is the relationship between elements?

Navigation between pages

How to map the thought process to support navigation?

Example Exercise

Organize the following list of items

  • Refrigerator
  • Socks
  • Dresser
  • Living Room
  • Dictionary
  • Kitchen
  • Milk
  • Bookshelf
  • Bedroom

There are several ways

Alphabetical list

By size:

  • Large: kitchen, bedroom, living room
  • Medium: bookshelf, refrigerator, dresser
  • Small: socks, dictionary, milk

By room:

  • Kitchen: refrigerator, milk
  • Living Room: dictionary, bookshelf
  • Bedroom: dresser, socks

By exact location:

  • Kitchen: refrigerator → milk
  • Living Room: dictionary → bookshelf
  • Bedroom: dresser → socks

Site Navigation

Biggest Problem: Not organizing site around the way users think

Organizing site based on some inner company structure the user can't relate to

Unclear descriptions. Where will this take me?

Inconsistent link behavior

Can people find what they are looking for?

Learn how site visitors think. Structure site to match their mental model

Types of Navigation

Structural - Basic linkage between pages defining overall site structure

Categorical - breaking of content into different categories understandable to user

Relational - linkage between content related in some manner in thought process

Promotional - calls attention to special items or content

Search - direct path to items specifically identified by the user

Navigation

Four critical user questions

Where am I?

Where can I go?

How will I get to my desired content?

How can I get back to where I once was?

The Web's non-linear presentation of content can be confusing and overwhelming

screen shot
screen shot

Principles of Successful Navigation

Be easily learned

People don't invest time learning to use a website

Remain consistent

Should be predictable. User shouldn't feel lost

Provide feedback

Let user know where they are

Principles of Successful Navigation

Offer alternatives

Don't tie user to one way of moving around

Economize action & time

People lost interest if the path is long

Use clear & understandable labels

Never use a big word when a small one will do

Pseudo Classes


Pseudo Classes

CSS pseudo classes are designed to allow us to add special effects to some selectors

For instance, if we wanted to change the way a hyperlink looks when someone hovers over a link, we can use the :hover pseudo class

Pseudo Classes

A pseudo class is denoted with a colon, ':'

For example:

a:hover {
    color: #ff00ff;
}

/* or */

nav a:hover {
    color: #ff00ff;
}

Pseudo Classes

:linka:linkunvisited links
:visiteda:visitedvisited links
:activea:activeactive links
:hovera:hovermoused-over links
:first-childtable:first-childwill affect the first row of table
:first-linep:first-linefirst line of the paragraph

Unordered List Navigation Bar


Example of using CSS to modify a set of tags

HTML & CSS - Navigation Bar

Using HTML and CSS, we can transform a basic unordered list into a navigation bar:

screen shot

HTML Nav Bar

/* First, remove the bullets, margins, 
and paddings from the list: */
ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

/* Then */
li {
    float: left;
}

HTML Nav Bar

/* Set anchor elements' display and width */
li > a {
    display: block;
    width: 60px;
}
screen shot

HTML Nav Bar

/* Let's pretty it up */
li > a:link, li > a:visited {
    display: block;
    float: left;
    width: 100px;
    margin-right: 3px;
    line-height: 1.8em;
    background-color: #00a;
    color: #fff;
    border-radius: 10px;
    text-align: center;
    text-decoration: none;
    position: relative;
    left: 50px;
    top: -15px;
}  /* and -> */

HTML Nav Bar

li > a:hover, li > a:active, .current {
    background-color: #a0a;
    color: #ff0;
}
screen shot

Lecture Quiz

No quiz, this time :)