To send the form-data as an HTTP post transaction, the method attribute should be set to ______.
- fetch
- get
- post
- put
The "method" attribute of the
The _______ HTML element is typically displayed as an inline-block.
-
The
element in HTML, which is used to embed images in web documents, is typically displayed as an inline-block element. This means it flows within the content and occupies only as much width as necessary, but you can also apply margins and padding around it, unlike purely inline elements. The display behavior of
makes it flexible to be used within text content or as stand-alone visual elements.
To target a specific cell in a table with CSS, the ______ pseudo-class can be particularly useful.
- :first-child
- :hover
- :nth-child()
- :target
The :nth-child() pseudo-class in CSS is extremely useful for targeting specific elements based on their position in a list or a sequence. For instance, in a table, you can use :nth-child() to target a specific cell or a row. This provides a high degree of control in styling tables without adding extra classes or IDs to the table elements.
What is the primary purpose of the alt attribute in an img tag?
- To define the image source URL.
- To enhance the image's resolution.
- To offer a text description of the image for screen readers and when the image cannot be displayed.
- To provide a tooltip when the mouse hovers over the image.
The alt attribute, often called an "alt tag" (though technically it's an attribute, not a tag), is used to describe the content of an image. This serves two main purposes: accessibility and usability. For visually impaired users utilizing screen readers, the alt text provides a description of the image's content. Additionally, if an image fails to load for any reason, the alt text will be displayed in its place, informing users of the intended content.
Imagine that you are tasked with creating a data table that has numerous columns and rows. The first two columns contain critical information, while the rest can be viewed on demand. How would you approach designing this table responsively?
- Displaying all columns and adding a vertical scrollbar.
- Hiding secondary columns behind a dropdown menu.
- Making only the first two columns fixed and allowing horizontal scrolling for others.
- Using pagination for all columns.
By making the first two columns fixed, you ensure that the vital information is always visible to users regardless of the device width. The rest of the columns can be accessed via horizontal scrolling, providing a balance between accessibility and clean design. This method respects the user's need for critical information while offering flexibility.
How can a developer ensure that the table caption is visually hidden but accessible to screen readers?
- By setting the display property to none.
- By using a combination of position: absolute; and clip: rect(0 0 0 0);
- By using the aria-hidden="true" attribute.
- By using the visibility property set to hidden.
Simply hiding content using CSS properties like display: none or visibility: hidden will make it invisible to both screen readers and visually. However, using a combination of position: absolute and clip: rect(0 0 0 0) can visually hide the content while still making it accessible to screen readers. This technique ensures that the information remains available to users who depend on assistive technologies.
The _____ CSS pseudo-class is used to style an element when it has keyboard focus.
- :active
- :focus
- :hover
- :visited
The :focus pseudo-class in CSS is used to add styles to an element when it has keyboard focus. This is particularly important for accessibility to highlight interactive elements like links, buttons, and form fields when they're selected using a keyboard. It helps users know which element they're currently interacting with.
The ______ attribute is used to specify the source URL of an embedded content.
- alt
- class
- src
- type
The src attribute is utilized in various tags like
,