HTML Intro

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What must all HTML documents start with?

All HTML documents must start with a type declaration: <!DOCTYPE html>.

How are HTML links defined?

HTML links are defined with the <a> tag: Example: <a href="http://www.w3schools.com">This is a link</a>

Where are attributes always specified?

Attributes are always specified in the start tag.

What is an attribute?

Attributes are used to provide additional information about HTML elements.

What do attributes come in?

Attributes come in name/value pairs like: name="value"

Why is declaring a language important?

Declaring a language is important for accessibility applications (screen readers) and search engines.

How can you close an empty element?

Empty elements can be "closed" in the opening tag like this: <br />.

Why is it a good idea to always use lowercase attributes?

Lower case is the most common. Lower case is easier to type. The HTML5 standard does not require lower case attribute names. The title attribute can be written with upper or lower case like Title and/or TITLE.

Do all HTML elements have end tags?

No, some HTML elements do not have an end tag.

What use is the lang Attribute?

The document language can be declared in the <html> tag. The language is declared in the lang attribute.

Which is the visible part of the HTML document?

The visible part of the HTML document is between <body> and </body>.

How would you describe a value of the lang attribute?

Example: <!DOCTYPE html> <html lang="en-US"> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> The first two letters specify the language (en). If there is a dialect, use two more letters (US).

What are HTML Elements?

HTML elements are written with a start tag, with an end tag, and with the content in between: <tagname>content</tagname> The HTML element is everything from the start tag to the end tag: <p>My first HTML paragraph.</p> Start tag Element content End tag <h1> My First Heading </h1> <p> My first paragraph. </p> <br>

What are empty HTML elements?

HTML elements with no content are called empty elements.

In an HTML page structure, which area is displayed by the browser?

Only the <body> area is displayed by the browser.

What does a style attribute do?

Specifies an inline CSS style for an element The HTML <style> element is used to define internal CSS style sheets.

What do all HTML documents begin and start with?

The HTML document itself begins with <html> and ends with </html>.

What file extension should you save the file with?

You can use either .htm or .html as file extension. There is no difference, it is up to you.

What is the purpose of a web browser?

a web browser (Chrome, IE, Firefox, Safari) is to read HTML documents and display them. The browser does not display the HTML tags, but uses them to determine how to display the document.

What are nested elements?

elements containing elements. All HTML documents consist of nested HTML elements.

What is The <!DOCTYPE> declaration?

The <!DOCTYPE> declaration helps the browser to display a web page correctly. There are different document types on the web. To display a document correctly, the browser must know both type and version. The doctype declaration is not case sensitive. All cases are acceptable: <!DOCTYPE html> <!DOCTYPE HTML> <!doctype html> <!Doctype Html>

What is the common declaration for HTML5?

<!DOCTYPE html>

What kinds of simple editors can be used for editing HTML?

Notepad (PC) or TextEdit (Mac).

What is an example of an empty element?

<br> is an empty element without a closing tag (the <br> tag defines a line break).

How are HTML paragraphs defined?

HTML paragraphs are defined with the <p> tag: Example: <p>This is a paragraph.</p> <p>This is another paragraph.</p>

What are HTML Tags?

HTML tags are keywords (tag names) surrounded by angle brackets: <tagname>content</tagname> HTML tags normally come in pairs like <p> and </p> The first tag in a pair is the start tag, the second tag is the end tag The end tag is written like the start tag, but with a slash before the tag name Note The start tag is often called the opening tag. The end tag is often called the closing tag.

Why should you use lowercase tags?

HTML tags are not case sensitive: <P> means the same as <p>. The HTML5 standard does not require lowercase tags, but W3C recommends lowercase in HTML4, and demands lowercase for stricter document types like XHTML.

What is a size attribute?

It determines the size of something like an image from the values entered into width and height. HTML images are defined with the <img> tag. The filename of the source (src), and the size of the image (width and height) are all provided as attributes: Example <img src="w3schools.jpg" width="104" height="142"> The image size is specified in pixels: width="104" means 104 screen pixels wide.

Where in a links' tag would the link address be specified?

The link address is specified in the href attribute. Example: <a href="http://www.w3schools.com">This is a link</a>

What are the attributes to be found in an HTML <img> tag?

The source file (src), alternative text (alt), and size (width and height).

How many elements are nested in this example? Example: <!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>

This example contains 4 HTML elements: 1. The <html> element defines the whole document. It has a start tag <html> and an end tag </html>. 2. The element content is another HTML element (the <body> element). The <body> element defines the document body. It has a start tag <body> and an end tag </body>. The element content is two other HTML elements (<h1> and <p>). 3. The <h1> element defines a heading. It has a start tag <h1> and an end tag </h1>. The element content is: My First Heading. 4.The <p> element defines a paragraph. It has a start tag <p> and an end tag </p>. The element content is: My first paragraph.

Why shouldn't you use headings to make text big and/or bold?

Use HTML headings for headings only. Don't use headings to make text BIG or bold. Search engines use your headings to index the structure and content of your web pages.

Why are headings important?

Users skim your pages by its headings. It is important to use headings to show the document structure. h1 headings should be main headings, followed by h2 headings, then the less important h3, and so on.

Why is it a good idea to always use quotes around attribute values?

W3C recommends quotes in HTML4, and demands quotes for stricter document types like XHTML. Sometimes it is necessary to use quotes. This will not display correctly, because it contains a space: <p title=About W3Schools> Basically, using quotes are the most common. Omitting quotes can produce errors.

Is the HTML <title> Element considered meta data?

Yes. The HTML <title> element is meta data. It defines the HTML document's title. The title will not be displayed in the document, but might be displayed in the browser tab.

How are HTML images defined?

HTML images are defined with the <img> tag. Example: <img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">

<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html>

Example Explained The DOCTYPE declaration defines the document type to be HTML The text between <html> and </html> describes an HTML document The text between <head> and </head> provides information about the document The text between <title> and </title> provides a title for the document The text between <body> and </body> describes the visible page content The text between <h1> and </h1> describes a heading The text between <p> and </p> describes a paragraph Using this description, a web browser can display a document with a heading and a paragraph.

Why would you close an empty element?

HTML5 does not require empty elements to be closed. But if you want stricter validation, or you need to make your document readable by XML parsers, you should close all HTML elements.

How can you view the source code on a webpage?

Have you ever seen a Web page and wondered "Hey! How did they do that?" To find out, right-click in the page and select "View Page Source" (in Chrome) or "View Source" (in IE), or similar in another browser. This will open a window containing the HTML code of the page.

What is a title attribute?

Specifies extra information about an element (displayed as a tool tip) When you move the mouse over the element, the title will be displayed as a tooltip. Example: <p title="About W3Schools"> W3Schools is a web developer's site. It provides tutorials and references covering many aspects of web programming, including HTML, CSS, JavaScript, XML, SQL, PHP, ASP, etc. </p> HTML paragraphs are defined with the <p> tag. In this example, the <p> element has a title attribute. The value of the attribute is "About W3Schools":

What is an href attribute?

Specifies the URL (web address) for a link. HTML links are defined with the <a> tag. The link address is specified in the href attribute: Example: <a href="http://www.w3schools.com">This is a link</a> In this example "This is a link" would appear as a hyperlink to w3schools.com.

What does the source attribute do?

Specifies the URL (web address) for an image.

What does the value attribute do?

Specifies the value (text content) for an input element.

Why should you never rely on an element displaying correctly without an end tag?

Example: <html> <body> <p>This is a paragraph <p>This is a paragraph </body> </html> The example above works in all browsers, because the closing tag is considered optional. Never rely on this. It might produce unexpected results and/or errors if you forget the end tag.

How are HTML headings defined?

HTML headings are defined with the <h1> to <h6> tags: Example: <h1>This is a heading</h1> <h2>This is a heading</h2> <h3>This is a heading</h3> <h1> defines the most important heading. <h6> defines the least important heading. Note: Browsers automatically add some empty space (a margin) before and after each heading.

What is HTML?

HTML is a markup language for describing web documents (web pages). HTML stands for Hyper Text Markup Language A markup language is a set of markup tags HTML documents are described by HTML tags Each HTML tag describes different document content

What is a horizontal rule tag?

The <hr> tag creates a horizontal line in an HTML page. The hr element can be used to separate content: Example <p>This is a paragraph.</p> <hr> <p>This is a paragraph.</p> <hr> <p>This is a paragraph.</p>

What is an HTML head element?

The HTML <head> element contains meta data. Meta data are not displayed. The HTML <head> element has nothing to do with HTML headings.

Where is an HTML head placed?

The HTML <head> element is placed between the <html> tag and the <body> tag: Example <!DOCTYPE html> <html> <head> <title>My First HTML</title> <meta charset="UTF-8"> </head> <body> . . .

What is the alt attribute?

The alt attribute specifies an alternative text to be used, when an HTML element cannot be displayed. The value of the attribute can be read by "screen readers". This way, someone "listening" to the webpage, i.e. a blind person, can "hear" the element. Example <img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">


Set pelajaran terkait

ISDS 3115 Quiz 1 Conceptual Questions

View Set

Foundations Test 2 PrepU questions

View Set

Genetics(H): Chapter 15 Practice Test(Relevant Questions)

View Set

Биохимия крови норма🤙

View Set

World's Largest Countries by Population

View Set

The Art of Public Speaking (Lucas) Chapter 7

View Set

CHAPTER 11: APPENDICULAR STRUCTURE

View Set