quiz 1 Flashcards
(130 cards)
- What is CSS and why is it useful in web design?
CSS (Cascading Style Sheets) is a language used to control the presentation of HTML documents. It separates content from presentation, allows consistent styling across pages, and enables design changes by editing one file rather than every page.
- Describe the three levels of style sheets in HTML.
Inline-level (within an element via the style attribute), Document-level (embedded in the head using a <style> tag), and External-level (in separate .css files linked via <link></link>).</style>
- What is the cascade in CSS and how does specificity affect style rules?
The cascade is the process by which the browser determines which CSS rule applies when multiple rules target the same element. Specificity is determined by selector type (inline > ID > class > element) and the order of declarations.
- What are the key differences between inline, embedded, and external CSS?
Inline CSS is written directly in the HTML tag, embedded CSS is placed in the <style> block in the head, and external CSS is in separate .css files. External CSS offers better reusability and maintainability.</style>
- Explain the purpose of a CSS font stack and give an example.
A font stack is a prioritized list of fonts used with the font-family property. For example: font-family: ‘Apple Chancery’, Script, ‘Times New Roman’, Courier; This tells the browser which font to use if the first choice isn’t available.
- What are some common text styling properties in CSS?
Common text styling properties include color, font-family, font-size, font-weight, text-align, text-transform, text-decoration, and text-shadow.
- How do you specify an RGB or HEX color value in CSS?
RGB values are specified using rgb(), e.g., rgb(255, 0, 0), and HEX values use a hash symbol, e.g., #FF0000.
- What does the term ‘Document Object Model’ (DOM) refer to?
The DOM is a tree-like representation of the HTML document created by the browser. It represents each element as a node, allowing scripts to modify content, structure, and styling dynamically.
- What is the purpose of the DOCTYPE declaration in HTML?
The DOCTYPE declaration tells the browser which version of HTML is being used. For HTML5, it is simply <!DOCTYPE html>.
- Describe the concept of ‘markup’ in HTML.
Markup is the process of annotating text with tags that define its structure and meaning, such as headings, paragraphs, links, images, and more.
- What are void (empty) elements in HTML and give three examples.
Void elements do not require a closing tag. Examples include <br></br>, <img></img>, and <hr>.
- What is the difference between absolute and relative URLs?
An absolute URL provides the full path (including protocol and domain) to a resource, while a relative URL specifies the path relative to the current document.
- How do you create a hyperlink in HTML and what are its main components?
Use the <a> tag with an href attribute for the destination, link text for the clickable area, and optionally a target attribute to specify where to open the link.</a>
- What is the role of the alt attribute in the <img></img> tag?
The alt attribute provides alternative text for an image, which is displayed if the image cannot load and is used for accessibility (e.g., screen readers).
- List the primary HTML elements used for creating lists and briefly describe each.
Unordered lists (<ul>) use bullets; Ordered lists (<ol>) use numbers or letters; Definition lists (<dl>) use <dt> for terms and <dd> for definitions.
- Explain the structure of an HTML table and name its main elements.
An HTML table is built with the <table> tag, containing rows (<tr>), header cells (<th>), and data cells (<td>). A <caption> may also be used for a title.
- What are semantic elements in HTML and why are they important?
Semantic elements (like <header>, <nav>, <section>, <article>, <footer>) describe the meaning of the content, improving accessibility, SEO, and code maintainability.
- What is the difference between the <section>, <article>, and <div> elements?
<section> represents a thematic grouping of content; <article> is a self-contained, independent piece of content; <div> is a generic container with no semantic meaning, used for styling and grouping.
</div></article></section>
- How do you embed a video from YouTube into an HTML page?
By using an <iframe> element with the YouTube embed URL, e.g., <iframe src='https://www.youtube.com/embed/VIDEO_ID?autoplay=1'></iframe>.
- What is the purpose of the HTML lang attribute and how is it used?
The lang attribute specifies the language of the document, which helps with accessibility and SEO. It is added to the <html> tag, e.g., <html lang='en-US'>.
- Outline the historical timeline of major web events from the early 1990s to the 2000s.
Key events include Tim Berners-Lee’s proposal in 1989, the first website in 1991, Netscape’s rise in the mid-90s, the advent of Internet Explorer in 1995, HTML 3.2 in 1997, and XHTML 1.0 in 2000.
- What major change did HTML5 bring compared to previous HTML versions?
HTML5 introduced new semantic elements, native multimedia support (audio and video), improved error handling, and a living standard approach that continuously evolves.
- What is the purpose of HTML forms and what are two common input types?
HTML forms collect user input. Common input types include text inputs (<input></input>) and radio buttons (<input></input>).
- Describe the concept of relative units (em, rem, percent) in CSS font sizing.
em is relative to the font size of its own element, rem is relative to the root element’s font size, and percent is relative to the parent element’s size. They allow scalable and responsive design.
Title
) and create a link with href='#section1' to jump to that section.), whereas inline elements only take up as much width as necessary and do not force a line break (e.g., , ).
) in HTML.