HTML: Attributes, Links, Images, Tables and Lists

HTML Attributes

An attribute is extra information placed inside an element’s opening tag, made up of a name (the property to set) and a value (always in quotes), e.g. <p align="center">This is center aligned</p>. Attribute names and values are case-insensitive, though the W3C recommends lowercase.

Core Attributes

The four core attributes usable on most HTML elements: Class (specifies one or more CSS class names), Id (a unique identifier for the element), Style (an inline CSS style), and Title (extra information, displayed as a tooltip).

HTML Lines, Comments, White Space and Headings

The <hr> tag draws a horizontal line to divide content. Comments (<!-- ... -->) explain code to the reader and are invisible on the rendered page. Browsers ignore all “white space” in the code – only tags control what happens. Headings are defined with <h1> (most important) through <h6> (least important); paragraphs are defined with <p>.

HTML Formatting

<b>/<strong> define bold text, <i>/<em> define italic text, <sub>/<sup> define subscript/superscript text, and <blockquote> defines an indented section of text. Underlining text in HTML is poor practice, as it can be mistaken for a link.

HTML Links

The <a> (anchor) tag defines a hyperlink, using the href attribute for the destination, e.g. <a href="home.html">Go to Home Page</a>. By default, an unvisited link is underlined and blue, a visited link is underlined and purple, and an active link is underlined and red. The target attribute controls where the linked document opens: _blank (new window/tab), _self (same frame), _parent, _top, or a named frame.

HTML Head

The <head> element is a container for elements like <title>, <base>, <link>, <meta>, <script> and <style>.

HTML Images

Images are displayed with the <img> tag, which needs no closing tag. Attributes: alt (alternate text describing the image), border, height, src (the file’s URL) and width.

HTML Tables

A table is comprised of rows and columns, always starting with the <table> tag. Rows are defined with <tr> and columns (cells) with <td> (“table data”), which can contain text, images, links, lists or any other HTML element.

HTML Lists

There are two types of list: Unordered (<ul>, bulleted) and Ordered (<ol>, numbered), both containing list items marked with <li>.

Leave a comment

Your email address will not be published. Required fields are marked *

sponsors Ads