1 Introduction to HTML
1 Introduction to HTML
In this instance, the image source (src) and the alt text (alt) are attributes of the <img> tag.
Golden Rules To Remember
2.When using multiple tags, the tags must be closed in the order
in which they were opened. For example:
<strong><em>This is really
important!</em></strong>
Creating Your First HTML Webpage
<!DOCTYPE html> — This tag specifies the language you will write on the page. In this case, the language is HTML 5.
<html> — This tag signals that from here on we are going to write in HTML code.
<head> — This is where all the metadata for the page goes — stuff mostly meant for search engines and other
computer programs.
This image tag has two attributes – an src attribute, the image path, and an alt
attribute, the descriptive text. However, it does not have content nor an end tag.
Lastly, every HTML document must start with a <!DOCTYPE> declaration to inform
the web browser about the document type. With HTML5, the doctype HTML public
declaration will be:
<!DOCTYPE html>
Further Tags
Inside the <head> tag, there is one tag that is always included: <title>, but there are others
that are just as important:
<title>
This is where we insert the page name as it will appear at the top of the browser window or tab.
<meta>
This is where information about the document is stored: character encoding, name (page context), description.
<head>
<title>My First Webpage</title>
<meta charset="UTF-8">
<meta name="description" content="This field contains information about your page. It is usually
around two sentences long.">.
<meta name="author" content="Conor Sheils">
</header>
Block-Level Elements
▪ A block-level element takes up the entire width of a page. It always starts a
new line in the document. For example, a heading element will be in a
separate line from a paragraph element.
▪ Every HTML page uses these three tags:
▪ <html> tag is the root element that defines the whole HTML document.
▪ <head> tag holds meta information such as the page’s title and charset.
▪ <body> tag encloses all the content that appears on the page.
▪ Other popular block-level tags include:
▪ Heading tags – these range from <h1> to <h6>, where heading h1 is largest in size,
getting smaller as they move up to h6.
▪ Paragraph tags – are all enclosed by using the <p> tag.
▪ List tags – have different variations. Use the <ol> tag for an ordered list, and use <ul>
for an unordered list. Then, enclose individual list items using the <li> tag.
Inline Elements
• An inline element formats the inner content of block-level elements, such
as adding links and emphasized strings. Inline elements are most
commonly used to format text without breaking the flow of the content.
• For example, a <strong> tag would render an element in bold, whereas the
<em> tag would show it in italics. Hyperlinks are also inline elements that
use an <a> tag and an href attribute to indicate the link’s destination: