HTML Basics Quiz
8 Questions
1 Views

HTML Basics Quiz

Created by
@TimelyXenon

Questions and Answers

What is the purpose of the <!DOCTYPE html> declaration in an HTML document?

  • It is used to include external scripts.
  • It marks the end of the HTML document.
  • It defines the language of the document.
  • It indicates the version of HTML being used. (correct)
  • Which of the following elements is used to create a clickable hyperlink?

  • <link>
  • <hyperlink>
  • <a> (correct)
  • <anchor>
  • When defining an image in HTML, what attribute is used to specify the file destination?

  • src (correct)
  • alt
  • href
  • image
  • What does the alt attribute in an image tag provide?

    <p>A description if the image fails to load.</p> Signup and view all the answers

    Which HTML element would you use to create a numbered list?

    <ol> Signup and view all the answers

    What is the purpose of comments in HTML?

    <p>To leave notes for developers that are not displayed in the browser.</p> Signup and view all the answers

    Which tag is used to define a paragraph in HTML?

    <p> Signup and view all the answers

    What does the target attribute in an anchor tag specify?

    <p>How the link opens in a browser.</p> Signup and view all the answers

    Study Notes

    HTML Basics

    • HTML Definition: Hypertext Markup Language is the standard language for creating web pages.

    • Structure of HTML Document:

      • Doctype Declaration: <!DOCTYPE html> - indicates the document type and version.
      • HTML Element: <html> - root element that contains all other elements.
      • Head Element: <head> - contains meta-information, links to stylesheets, scripts, and the title.
      • Body Element: <body> - contains the content of the web page, such as text, images, and links.
    • Basic Syntax:

      • HTML elements consist of tags, which are enclosed in angle brackets (e.g., <tagname>).
      • Most elements have an opening tag and a corresponding closing tag (e.g., <tagname></tagname>).
    • Attributes:

      • Provide additional information about elements.
      • Syntax: <element attribute="value">.
      • Common attributes: id, class, style, src, href.
    • Comments:

      • Used to leave notes in the code, not displayed in the browser.
      • Syntax: <!-- Comment here -->.
    • Text Formatting Elements:

      • <h1> to <h6>: Headings (h1 is the largest, h6 is the smallest).
      • <p>: Paragraph.
      • <strong>: Bold text.
      • <em>: Italicized text.
    • Lists:

      • Ordered List: <ol> - numbered list.
      • Unordered List: <ul> - bullet list.
      • List Item: <li> - defines a list item.
    • Links (Hyperlinks):

      • Defined using the <a> tag (anchor tag).
      • Syntax: <a href="URL">Link Text</a>.
        • href: specifies the URL the link points to.
        • target: can specify how to open the link (e.g., _blank for new tab).
    • Images:

      • Added using the <img> tag.
      • Syntax: <img src="imageURL" alt="description">.
        • src: the source of the image file.
        • alt: alternative text for the image.
    • Forms:

      • <form>: used to collect user input.
      • Common elements include <input>, <textarea>, <select>, and <button>.

    HTML Overview

    • HTML: Stands for Hypertext Markup Language; it's the standard markup language for web page creation.

    Structure of HTML Document

    • Doctype Declaration: <!DOCTYPE html> signifies the document type and version of HTML being used.
    • HTML Element: The root element is <html>, which encapsulates all other elements in the document.
    • Head Element: <head> includes meta-information about the document, like <title>, links to stylesheets and scripts.
    • Body Element: <body> contains the actual content of the webpage such as text, images, and links.

    Basic Syntax

    • HTML elements consist of tags wrapped in angle brackets (e.g., <tag>).
    • Most elements have an opening and a closing tag (e.g., <tag>...</tag>), forming a structure.
    • Attributes: Offer additional details about elements, formatted as attribute="value".
    • Common attributes include id, class, style, src, and href.

    Comments

    • Used for leaving notes within the code for developers; not shown in the browser.
    • Syntax for comments is <!-- Comment here -->.

    Text Formatting Elements

    • Headings: Created using <h1> to <h6>, where <h1> is the largest and <h6> is the smallest.
    • Paragraph: Defined using <p>.
    • Text styles include <strong> for bold and <em> for italicized text.

    Lists

    • Ordered List: Created using <ol>, produces a numbered list.
    • Unordered List: Created using <ul>, produces a bulleted list.
    • List Item: Defined with <li> within either list type.
    • Formed using <a> (anchor tag).
    • Syntax: <a href="URL">Link Text</a>.
    • The href attribute specifies the target URL, while target can control link opening behavior (e.g., _blank opens in a new tab).

    Images

    • Included with the <img> tag.
    • Syntax: <img src="imageURL" alt="description">.
    • The src attribute denotes the source file, while alt provides alternative text for the image.

    Forms

    • <form>: Utilized for collecting user input.
    • Common form elements include <input>, <textarea>, <select>, and <button>.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge on the fundamentals of HTML, including its structure, basic syntax, and commonly used attributes. This quiz will cover the essential elements that form the backbone of web pages and web development. Perfect for beginners looking to solidify their understanding of HTML.

    More Quizzes Like This

    HTML and XML Basics Quiz
    5 questions

    HTML and XML Basics Quiz

    ProductiveCarnelian avatar
    ProductiveCarnelian
    HTML Syntax Basics
    16 questions

    HTML Syntax Basics

    FirmerJudgment697 avatar
    FirmerJudgment697
    HTML Basics for Beginners
    6 questions

    HTML Basics for Beginners

    EffectualBambooFlute avatar
    EffectualBambooFlute
    Introduction to HTML
    8 questions

    Introduction to HTML

    LuxuriantCarnelian4523 avatar
    LuxuriantCarnelian4523
    Use Quizgecko on...
    Browser
    Browser