HTML Basics

What is HTML?

HTML (Hyper Text Markup Language) is a semantic markup language for creating web documents / content. HTML markup is comprised of plain text and HTML Tags.

HTML Tags

HTML tags are keywords that are wrapped with angle brackets: <tagname>content goes in-between </tagname>.

Most HTML tags require and opening tag and a closing tag.

There are a couple self closing tags which are defined as: <tagname />. Notice the /, this closes the tag.

Deprecated Tags - Do Not Use

The following tags no longer meet current HTML standards and should no longer be used.

  • <font>, <center>, <nobr>
  • <b>, <i> - technically not deprecated but should only be used on rare occasions, learn more.

Want to learn a little more HTML? Here are some great resources:

Headings

There are 6 heading styles defined by the <h1> to <h6> tags. <h1> being the most important and <h6> being the least important.

EXAMPLE

h1. Primary heading

Page Titles only

h2. Secondary heading

 

h3. Trinary heading

 

h4. Quaternary heading

 
h5. Quinary heading
 
h6. Senary heading
 

 

Paragraphs

Paragraphs are defined with the <p> tag.

EXAMPLE

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras vulputate fringilla tristique. Quisque quis sem sed ante vulputate tempus. Duis commodo, nisi fringilla cursus efficitur, erat turpis venenatis purus, eu sagittis mi leo fermentum ipsum. Donec pharetra quis leo luctus venenatis. Cras dictum magna quis nisl ultricies, eu semper enim imperdiet. Nam in sapien tristique, lacinia orci finibus, interdum ex. Donec vehicula massa vel lectus consequat, et efficitur lectus dignissim. Vivamus condimentum sapien malesuada arcu ullamcorper, quis semper massa dapibus. Nulla at nisl sed diam mattis laoreet. Aliquam elementum gravida massa, a finibus mauris hendrerit sed. Donec nec magna scelerisque, scelerisque odio sit amet, fermentum neque.

 

Line Breaks

Line Breaks are defined with the <br /> tag.

EXAMPLE

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Cras vulputate fringilla tristique.
Quisque quis sem sed ante vulputate tempus. Duis commodo, nisi fringilla cursus efficitur, erat turpis venenatis purus, eu sagittis mi leo fermentum ipsum. Donec pharetra quis leo luctus venenatis.
Cras dictum magna quis nisl ultricies, eu semper enim imperdiet. Nam in sapien tristique, lacinia orci finibus, interdum ex. Donec vehicula massa vel lectus consequat, et efficitur lectus dignissim. Vivamus condimentum sapien malesuada arcu ullamcorper, quis semper massa dapibus. Nulla at nisl sed diam mattis laoreet.
Aliquam elementum gravida massa, a finibus mauris hendrerit sed. Donec nec magna scelerisque, scelerisque odio sit amet, fermentum neque.

 

Bold Emphasis

To provide bold emphasis to a span of text, wrap the span with a <strong> tag.

EXAMPLE

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

 

Italic Emphasis

To provide italic emphasis to a span of text, wrap the span with a <em> tag.

EXAMPLE

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

 

Hyperlinks

Hyperlinks are defined with the <a /> tag.

The link is defined with the href attribute.

EXAMPLE

Go to njcpa.org

 

Open Hyperlink In New Window

You can add the target="_blank" to your link to open it in a new tab/window.

EXAMPLE

New Window: Go to njcpa.org

 

Lists

Lists are defined with the <ol> tag for orders lists and the <ul> tag for unordered lists.

EXAMPLE

Ordered List

  1. Ordered List Item
  2. Ordered List Item
  3. Ordered List Item
  4. Ordered List Item

Unordered List

  • Unordered List Item
  • Unordered List Item
  • Unordered List Item
  • Unordered List Item

 

Horizontal Rule

Horizontal Rule are defined with the <hr /> tag.

EXAMPLE

 

Tables

Tables are defined with the <table> tag.

Rows are defined with the <tr> tag.

Table headers are defined with the <th> tag.

Table cells are defined with the <td> tag.

Unstyled Table  (as basic it gets)

Note: unstyled tables width is based on the content entered into the cells.

EXAMPLE
Heading 1 Heading 2 Heading 3
Cell Cell Cell
Cell Cell Cell

 

Styled Table  Recommended!

To style the table, add class="table" to the table tag.

The styled table adds:

  • a top border to all rows.
  • a padding of 8 pixels to all cells.
  • sets table width to 100%.
  • adds a bottom margin of 18 pixels.
  • sets the vertical alignment of the cells to top.
EXAMPLE
Heading 1 Heading 2 Heading 3
Cell Cell Cell
Cell Cell Cell