HTML5 Flashcards

1
Q
A

declaration defines that this document is an HTML5 document

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
A

declaration defines that this document is an HTML5 document

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
A

element is the root element of an HTML page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
A

element contains meta information about the HTML page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A

element specifies a title for the HTML page (which is shown in the browser’s title bar or in the page’s tab)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A

element defines the document’s body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

<h1></h1>

A

element defines a large heading, can have up to 6, h1, h2, h3, etc each gets smaller, it’s good practice to only use one h1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

<p></p>

A

element defines a paragraph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an HTML Element?

A

An HTML element is defined by a start tag, some content, and an end tag:
Content goes here…
The HTML element is everything from the start tag to the end tag:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Web Browsers

A

The purpose of a web browser (Chrome, Edge, Firefox, Safari) is to read HTML documents and display them correctly.

A browser does not display the HTML tags, but uses them to determine how to display the document:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

<a></a>

A

HTML links are defined with the <a> tag:</a>

Example
</a><a>This is a link</a>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

<img></img>

A

HTML images are defined with the <img></img> tag.

The source file (src), alternative text (alt), width, and height are provided as attributes:

Example
<img></img>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

<br></br>

A

The <br></br> tag defines a line break, and is an empty element without a closing tag:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

HTML is Not Case Sensitive

A

HTML tags are not case sensitive: <p> means the same as </p><p>.

The HTML standard does not require lowercase tags, but W3C recommends lowercase in HTML, and demands lowercase for stricter document types like XHTML.</p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

HTML Attributes

A

All HTML elements can have attributes
Attributes provide additional information about elements
Attributes are always specified in the start tag
Attributes usually come in name/value pairs like: name=”value”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The href Attribute

A

The <a> tag defines a hyperlink. The href attribute specifies the URL of the page the link goes to:</a>

Example
</a><a>Visit W3Schools</a>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

The src Attribute

A

The <img></img> tag is used to embed an image in an HTML page. The src attribute specifies the path to the image to be displayed:

Example
<img></img>
There are two ways to specify the URL in the src attribute:
1. Absolute URL - Links to an external image that is hosted on another website. Example: src=”https://www.w3schools.com/images/img_girl.jpg”.2.

Relative URL - Links to an image that is hosted within the website. Here, the URL does not include the domain name. If the URL begins without a slash, it will be relative to the current page. Example: src=”img_girl.jpg”. If the URL begins with a slash, it will be relative to the domain. Example: src=”/images/img_girl.jpg”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The width and height Attributes for images

A

The <img></img> tag should also contain the width and height attributes, which specifies the width and height of the image (in pixels):

Example
<img></img>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The alt Attribute

A

The required alt attribute for the <img></img> tag specifies an alternate text for an image, if the image for some reason cannot be displayed. This can be due to slow connection, or an error in the src attribute, or if the user uses a screen reader.

Example
<img></img>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The style Attribute

A

The style attribute is used to add styles to an element, such as color, font, size, and more.

Example

<p>This is a red paragraph.</p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

The lang Attribute

A

You should always include the lang attribute inside the tag, to declare the language of the Web page. This is meant to assist search engines and browsers.

The following example specifies English as the language:

Country codes can also be added to the language code in the lang attribute. So, the first two characters define the language of the HTML page, and the last two characters define the country.

The following example specifies English as the language and United States as the country:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The title Attribute

A

The title attribute defines some extra information about an element.

The value of the title attribute will be displayed as a tooltip when you mouse over the element:

Example

<p>This is a paragraph.</p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Single or Double Quotes?

A

Double quotes around attribute values are the most common in HTML, but single quotes can also be used.

In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes:

<p>
Or vice versa:

</p>

<p></p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Bigger Headings

A

Each HTML heading has a default size. However, you can specify the size for any heading with the style attribute, using the CSS font-size property:

Example

<h1>Heading 1</h1>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
HTML Horizontal Rules
The
tag defines a thematic break in an HTML page, and is most often displayed as a horizontal rule. The
element is used to separate content (or define a change) in an HTML page: ``` Example

This is heading 1

This is some text.


This is heading 2

This is some other text.


``` The
tag is an empty tag, which means that it has no end tag.
26
HTML Line Breaks
The HTML
element defines a line break. Use
if you want a line break (a new line) without starting a new paragraph: Example

This is
a paragraph
with line breaks.

The
tag is an empty tag, which means that it has no end tag.
27
The Poem Problem This poem will display on a single line: Example

My Bonnie lies over the ocean. My Bonnie lies over the sea. My Bonnie lies over the ocean. Oh, bring back my Bonnie to me.

Solution - The HTML
 Element
The HTML 
 element defines preformatted text.

The text inside a 
 element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks:

Example
  My Bonnie lies over the ocean.

  My Bonnie lies over the sea.

  My Bonnie lies over the ocean.

  Oh, bring back my Bonnie to me.
28
HTML Styles
The HTML style attribute is used to add styles to an element, such as color, font, size, and more.
29
The HTML Style Attribute
Setting the style of an HTML element, can be done with the style attribute. The HTML style attribute has the following syntax:
30
Background Color
The CSS background-color property defines the background color for an HTML element Example Set the background color for a page to powderblue:

This is a heading

This is a paragraph.

31
Text Color
The CSS color property defines the text color for an HTML element: Example

This is a heading

This is a paragraph.

32
Fonts
The CSS font-family property defines the font to be used for an HTML element: Example

This is a heading

This is a paragraph.

33
Text Size
The CSS font-size property defines the text size for an HTML element: Example

This is a heading

This is a paragraph.

34
Text Alignment
The CSS text-align property defines the horizontal text alignment for an HTML element: Example

Centered Heading

Centered paragraph.

35
HTML Formatting Elements
Formatting elements were designed to display special types of text: ``` - Bold text - Important text - Italic text - Emphasized text - Marked text - Smaller text - Deleted text - Inserted text - Subscript text - Superscript text ```
36
HTML and Elements
The HTML element defines text with strong importance. The content inside is typically displayed in bold.
37
HTML and Elements
The HTML element defines emphasized text. The content inside is typically displayed in italic.
38
HTML Element
The HTML element defines smaller text:
39
HTML Element
The HTML element defines text that should be marked or highlighted: Example

Do not forget to buy milk today.

40
HTML Element
The HTML element defines text that has been deleted from a document. Browsers will usually strike a line through deleted text: Example

My favorite color is blue red.

41
HTML Element
The HTML element defines a text that has been inserted into a document. Browsers will usually underline inserted text: Example

My favorite color is blue red.

42
HTML Element
The HTML element defines subscript text. Subscript text appears half a character below the normal line, and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O: Example

This is subscripted text.

43
HTML Element |
The HTML element defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font. Superscript text can be used for footnotes, like WWW[1]: Example

This is superscripted text.

44
HTML
for Quotations
The HTML
element defines a section that is quoted from another source. Browsers usually indent
elements. Example

Here is a quote from WWF's website:

For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
45
HTML for Short Quotations
The HTML tag defines a short quotation. Browsers normally insert quotation marks around the quotation. Example

WWF's goal is to: Build a future where people live in harmony with nature.

46
HTML for Abbreviations
The HTML tag defines an abbreviation or an acronym, like "HTML", "CSS", "Mr.", "Dr.", "ASAP", "ATM". Marking abbreviations can give useful information to browsers, translation systems and search-engines. Tip: Use the global title attribute to show the description for the abbreviation/acronym when you mouse over the element. Example

The WHO was founded in 1948.

47
HTML
for Contact Information |
The HTML
tag defines the contact information for the author/owner of a document or an article. The contact information can be an email address, URL, physical address, phone number, social media handle, etc. The text in the
element usually renders in italic, and browsers will always add a line break before and after the
element. ``` Example
Written by John Doe.
Visit us at:
Example.com
Box 564, Disneyland
USA
```
48
HTML for Work Title
The HTML tag defines the title of a creative work (e.g. a book, a poem, a song, a movie, a painting, a sculpture, etc.). Note: A person's name is not the title of a work. The text in the element usually renders in italic. Example

The Scream by Edvard Munch. Painted in 1893.

49
HTML for Bi-Directional Override
BDO stands for Bi-Directional Override. The HTML tag is used to override the current text direction: Example This text will be written from right to left
50
HTML Comment Tags
You can add comments to your HTML source by using the following syntax:
51
Text Color
Example

Hello World

Lorem ipsum...

Ut wisi enim...

52
Border Color
Example

Hello World

Hello World

Hello World

53
Color Values
In HTML, colors can also be specified using RGB values, HEX values, HSL values, RGBA values, and HSLA values. The following three
elements have their background color set with RGB, HEX, and HSL values:

...

...

...

The following two
elements have their background color set with RGBA and HSLA values, which adds an Alpha channel to the color (here we have 50% transparency):

...

...

54
HTML Styles - CSS
What is CSS? Cascading Style Sheets (CSS) is used to format the layout of a webpage. With CSS, you can control the color, font, the size of text, the spacing between elements, how elements are positioned and laid out, what background images or background colors are to be used, different displays for different devices and screen sizes, and much more!
55
Using CSS
CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements Internal - by using a element in the section External - by using a element to link to an external CSS file The most common way to add CSS, is to keep the styles in external CSS files. However, in this tutorial we will use inline and internal styles, because this is easier to demonstrate, and easier for you to try it yourself.
56
Inline CSS
An inline CSS is used to apply a unique style to a single HTML element. An inline CSS uses the style attribute of an HTML element. The following example sets the text color of the

element to blue, and the text color of the

element to red: Example

A Blue Heading

A red paragraph.

57
Internal CSS
An internal CSS is used to define a style for a single HTML page. An internal CSS is defined in the section of an HTML page, within a element. The following example sets the text color of ALL the

elements (on that page) to blue, and the text color of ALL the

elements to red. In addition, the page will be displayed with a "powderblue" background color: ``` Example