HTML and CSS Basics Quiz
18 Questions
0 Views

HTML and CSS Basics Quiz

Created by
@BriskOrangutan

Questions and Answers

What is the primary purpose of the HTML declaration?

  • To specify the HTML version being used (correct)
  • To define the root element of the HTML document
  • To link external CSS stylesheets
  • To set the character set of the document
  • Which CSS selector is used to target an element with a specific ID?

  • #idname { } (correct)
  • classname { }
  • .classname { }
  • element { }
  • Which property is used to change the background color of an element in CSS?

  • color
  • bg-color
  • background-color (correct)
  • background
  • What is a common technique for making web pages responsive to different devices?

    <p>Applying media queries based on device characteristics</p> Signup and view all the answers

    Which element is used to link an external CSS file to an HTML document?

    <link> Signup and view all the answers

    What is the effect of using max-width: 100% on images in a responsive design?

    <p>Images will scale down to fit their container, but not enlarge</p> Signup and view all the answers

    How do you define a flexible grid layout in CSS?

    <p>By employing percentages for widths instead of fixed units</p> Signup and view all the answers

    Which HTML element contains the title displayed in the browser tab?

    &lt;title> Signup and view all the answers

    Thẻ HTML nào được sử dụng để tạo tiêu đề của trang web?

    &lt;title> Signup and view all the answers

    Thẻ nào được sử dụng để thêm một bình luận vào tài liệu HTML?

    <!-- comment --> Signup and view all the answers

    Trong HTML, thẻ nào được sử dụng để tạo một danh sách không có thứ tự?

    <ul> Signup and view all the answers

    Thẻ nào là một thành phần không cần thẻ đóng?

    <br> Signup and view all the answers

    Thẻ nào không phải là một thẻ ngữ nghĩa trong HTML?

    <div> Signup and view all the answers

    Thẻ nào được sử dụng để tạo một liên kết đến một trang web khác?

    <a> Signup and view all the answers

    Thẻ nào dùng để hiển thị hình ảnh trong HTML?

    <img> Signup and view all the answers

    Thẻ nào xác định phần nội dung chính của một trang HTML?

    <body> Signup and view all the answers

    Đặc điểm nào không phải là của thẻ HTML?

    <p>Có khả năng tự đóng</p> Signup and view all the answers

    Thẻ nào được sử dụng để tạo một danh sách có thứ tự trong HTML?

    <ol> Signup and view all the answers

    Study Notes

    HTML Structure

    • HTML Definition: HyperText Markup Language, used for creating web pages.
    • Basic Structure:
      • <!DOCTYPE html>: Declaration defining document type.
      • <html>: Root element of an HTML page.
      • <head>: Contains metadata, links to stylesheets, and scripts.
        • <title>: Sets the title displayed in the browser tab.
        • <meta>: Specifies character set, viewport, and other metadata.
      • <body>: Contains the content of the web page (text, images, links).
    • Common Elements:
      • Headings: <h1> to <h6> for different heading levels.
      • Paragraphs: <p> for text blocks.
      • Links: <a href="URL"> for hyperlinks.
      • Images: <img src="image.jpg" alt="description">.
      • Lists: <ul> (unordered) and <ol> (ordered) for lists with <li> (list items).

    CSS Styling Techniques

    • CSS Definition: Cascading Style Sheets, used for styling HTML elements.
    • Selectors:
      • Element Selector: Target specific HTML elements (e.g., p {}).
      • Class Selector: Target elements with a specific class (e.g., .classname {}).
      • ID Selector: Target a unique element with an ID (e.g., #idname {}).
    • Styling Properties:
      • Color: color (text color), background-color (element background).
      • Fonts: font-family, font-size, font-weight.
      • Box Model: margin, padding, border, width, height.
      • Display: block, inline, inline-block, flex, grid.
    • External Stylesheets: Link CSS files using <link rel="stylesheet" href="styles.css"> in the <head>.

    Responsive Design

    • Definition: Designing web pages that adapt to various screen sizes and devices.
    • Techniques:
      • Fluid Layouts: Use percentages instead of fixed pixels for widths.
      • Media Queries: Apply styles based on device characteristics.
        • Example: @media (max-width: 600px) { /* styles */ }.
      • Flexible Images: Use max-width: 100%; to make images responsive.
      • Viewport Meta Tag: <meta name="viewport" content="width=device-width, initial-scale=1.0"> ensures proper scaling on mobile devices.
    • Frameworks: Consider using CSS frameworks like Bootstrap or Foundation for pre-built responsive design components.

    HTML Structure

    • HTML: A markup language that structures content on web pages.
    • Basic Structure:
      • <!DOCTYPE html>: Document type declaration indicating HTML5.
      • <html>: The root container for an HTML document.
      • <head>: Contains metadata, links, stylesheets, and scripts for the page.
      • <title>: Displays the page title in the browser’s title bar or tab.
      • <meta>: Defines character set, viewport settings, and additional metadata.
      • <body>: Encloses the visible content of the web page including text, images, and links.
    • Common Elements:
      • Headings: Structured from <h1> (largest) to <h6> (smallest) for hierarchical text representation.
      • Paragraphs: Use <p> tags to create text blocks.
      • Links: Implemented with the <a> tag to create hyperlinks.
      • Images: Inserted using <img> tags for visual content.
      • Lists: Structured with <ul> for unordered lists, <ol> for ordered lists, and <li> for individual list items.

    CSS Styling Techniques

    • CSS: A stylesheet language that describes the presentation of HTML elements.
    • Selectors:
      • Element Selector: Targets specific HTML elements by type (e.g., p {} for paragraphs).
      • Class Selector: Applies styles to all elements with a designated class (e.g., .classname {}).
      • ID Selector: Singularly targets an element with a unique ID (e.g., #idname {}).
    • Styling Properties:
      • Color: Set element text color using the color property, and adjust backgrounds with background-color.
      • Fonts: Customize text appearance using font-family, font-size, and font-weight.
      • Box Model: Manage spacing and dimensions through properties like margin, padding, border, width, and height.
      • Display Modes: Control how elements are rendered with block, inline, inline-block, flex, or grid.
    • External Stylesheets: Link CSS files to HTML documents using <link> within the <head> tag.

    Responsive Design

    • Responsive Design: A design approach that allows web pages to adapt to various screens and devices.
    • Techniques:
      • Fluid Layouts: Utilize percentage-based widths for flexibility rather than fixed pixel dimensions.
      • Media Queries: Enable styles to change according to device characteristics, allowing tailored design for different screen sizes (e.g., @media (max-width: 600px) { }).
      • Flexible Images: Make images responsive with the property max-width: 100%; to ensure they fit within their containing element.
      • Viewport Meta Tag: Use <meta name="viewport" content="width=device-width, initial-scale=1.0"> to ensure proper scaling on mobile devices.
      • Frameworks: Utilize CSS frameworks such as Bootstrap or Foundation to quickly implement responsive design components.

    HTML Basics

    • HTML stands for HyperText Markup Language and is essential for creating web pages.
    • The document begins with a <!DOCTYPE html> declaration indicating the HTML version.

    Document Structure

    • The root element of an HTML document is <html>, which contains all HTML content.
    • The document has two primary sections: the Head and Body.

    Head Section

    • <head>: Contains meta-information about the document.
    • <title>: Specifies the title displayed in the browser tab.
    • <meta>: Defines character set, keywords, descriptions, and viewport settings.
    • <link>: Connects external resources like CSS files for style.
    • <style>: Includes internal CSS styles for customization.

    Body Section

    • <body>: Encloses the content that appears on the web page.

    Text Elements

    • Header tags: <h1> to <h6> indicate headings, with <h1> being the most important and <h6> the least.
    • <p>: Used for paragraphs, organizing blocks of text.
    • <a>: Anchor tag for hyperlinks; uses the href attribute to specify the link target.
    • <strong> and <em>: Indicate bold and italic text, enhancing emphasis and readability.

    List Elements

    • <ul>: Unordered list, presenting items with bullet points.
    • <ol>: Ordered list, displaying items in a numbered format.
    • <li>: List item; used within <ul> or <ol> to denote individual entries.

    Image Element

    • <img>: Displays images and requires src for the image source and alt for alternative text.

    Other Elements

    • <div>: A block-level container for grouping other HTML elements.
    • <span>: An inline container used for styling a portion of text without disrupting flow.

    Attributes

    • Elements can have attributes such as id, class, and style to enhance styling and scripting.
    • Attributes are specified within the opening tag (e.g., <element attribute="value">).

    Semantic HTML

    • Semantic HTML employs elements that clearly convey meaning for better accessibility.
    • Examples of semantic elements include <header>, <footer>, <article>, <section>, and <aside>.

    Comments

    • HTML comments are marked with <!-- comment --> and do not affect the rendered output.

    Self-Closing Tags

    • Some HTML elements, like <br> (line break) and <hr> (horizontal rule), do not require a closing tag.

    HTML Versions

    • HTML5 is the latest version, introducing features like audio, video, and canvas support for enhanced multimedia content.

    Accessibility Considerations

    • Implementing alt attributes for images and using semantic elements improves web accessibility and usability for all users.

    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 fundamental structures of HTML and CSS. This quiz covers essential elements, basic structure, and styling techniques that are crucial for web development. Ideal for beginners looking to solidify their understanding of web page creation.

    More Quizzes Like This

    General Knowledge Quiz
    8 questions

    General Knowledge Quiz

    EnjoyableSchorl avatar
    EnjoyableSchorl
    HTML Structure and Tags Quiz
    10 questions

    HTML Structure and Tags Quiz

    AdvantageousVolcano avatar
    AdvantageousVolcano
    Use Quizgecko on...
    Browser
    Browser