Docsity

(Intermediate HTML & CSS) Positioning Grid Elements Knowledge Assessment Guide 2024, Exams of Computer Science

Partial preview of the text

Download (Intermediate HTML & CSS) Positioning Grid Elements Knowledge Assessment Guide 2024 and more Exams Computer Science in PDF only on Docsity!

INTERMEDIATE HTML & CSS

Positioning Grid Elements

KNOWLEDGE ASSESSMENT GUIDE

  1. Which CSS property is used to define the number of columns in a grid layout?
    • A) grid-template-rows
    • B) grid-template-columns
    • C) grid-column-gap
    • D) grid-row-gap
    • Answer: B) grid-template-columns
    • Rationale: The grid-template-columns property specifies the number and size of columns in a grid layout.
  2. What does the fr unit represent in CSS Grid Layout?
    • A) Fraction of the viewport width
    • B) Fraction of the available space
    • C) Fixed ratio
    • D) Fraction of the content size
    • Answer: B) Fraction of the available space
    • Rationale: The fr unit represents a fraction of the available space in the grid container.
  3. Which property is used to align grid items along the row axis?
    • A) align-items
    • B) justify-items
  • Rationale: The grid-gap property is used to create space between grid items.

Fill-in-the-Blank Questions

  1. The __________ property specifies the size of the rows in a grid layout.
  • Answer: grid-template-rows
  • Rationale: The grid-template-rows property defines the size of the rows in a grid layout.
  1. In CSS Grid, the __________ function is used to repeat a set of columns or rows.
  • Answer: repeat()
  • Rationale: The repeat() function allows for repeating a set of columns or rows in a grid layout.
  1. The __________ property aligns grid items along the column axis.
  • Answer: align-items
  • Rationale: The align-items property aligns grid items along the column axis (vertically).
  1. To span a grid item across multiple columns, you use the __________ property.
  • Answer: grid-column
  • Rationale: The grid-column property is used to span a grid item across multiple columns.
  1. The __________ property is used to define named grid areas.
  • Answer: grid-template-areas
  • Rationale: The grid-template-areas property defines named grid areas for easier placement of items.

True/False Questions

  1. The grid-auto-rows property defines the size of implicitly created rows.
  • Answer: True
  • Rationale: The grid-auto-rows property specifies the size of rows that are created implicitly.
  1. The minmax() function in CSS Grid allows you to set a minimum and maximum size for grid tracks.
  • Answer: True
  • Rationale: The minmax() function sets a minimum and maximum size for grid tracks.
  1. The grid-area property can only be used to define a single grid item.
  • Answer: False
  • Rationale: The grid-area property controls the placement of grid items in named grid areas.
  1. What does the auto keyword do when used in grid-template- columns or grid-template-rows?
  • A) Sets the size to the content size
  • B) Sets the size to the available space
  • C) Sets the size to a fixed value
  • D) Sets the size to zero
  • Answer: A) Sets the size to the content size
  • Rationale: The auto keyword sets the size of the grid track to fit the content.
  1. Which property is used to define the space between rows in a grid layout?
  • A) row-gap
  • B) column-gap
  • C) grid-gap
  • D) grid-spacing
  • Answer: A) row-gap
  • Rationale: The row-gap property defines the space between rows in a grid layout.
  1. The grid-template-areas property uses a string syntax to define grid areas.
    • Answer: True
    • Rationale: The grid-template-areas property uses a string syntax to define named grid areas. Multiple Choice: Which CSS property is used to position an element within the grid system? A) float B) position C) display D) margin

Correct Answer: B) position

Rationale: The position property in CSS is specifically used to control the positioning of an element within the grid layout. Fill-in-the-Blank: The z-index property in CSS is used to control the __ of an element.

Correct Answer: stacking order

Fill-in-the-Blank: When using position: fixed, an element is positioned relative to the __.

Correct Answer: viewport

Rationale: Elements with position: fixed are positioned relative to the viewport and do not move when the page is scrolled. True/False: The display: grid property is used to create a two-dimensional grid-based layout system in CSS.

Correct Answer: True

Rationale: True. The display: grid property in CSS allows for the creation of complex two-dimensional grid layouts. Multiple Choice: Which CSS property is used to specify the size of grid columns and rows? A) grid-gap B) grid-template-columns C) grid-auto-flow D) grid-column

Correct Answer: B) grid-template-columns

Rationale: The grid-template-columns property is used to define the size of grid columns in a CSS grid layout. Fill-in-the-Blank: The justify-items property in CSS is used to align grid items along the __ axis.

Correct Answer: inline

Rationale: The justify-items property aligns grid items along the inline axis within a grid container. True/False: Grid items can span multiple rows and columns in a CSS grid layout.

Correct Answer: True

Rationale: True. Grid items in a CSS grid layout can span across multiple rows and columns using the grid-column and grid-row properties. Multiple Choice: Which value of the align-items property in CSS aligns grid items to the end of the grid container? A) center B) start

Multiple Choice: Which CSS property is used to align grid items within a grid cell? A) justify-self B) align-content C) grid-column-gap D) grid-auto-columns

Correct Answer: A) justify-self

Rationale: The justify-self property in CSS is used to align grid items within a grid cell along the inline axis. Fill-in-the-Blank: The grid-auto-rows property in CSS specifies the size of __ rows in a grid.

Correct Answer: implicit

Rationale: The grid-auto-rows property determines the size of implicitly created rows in a grid layout. True/False: Grid items with a specified grid-area value will automatically adjust their size to fit the defined area.

Correct Answer: True

Rationale: True. Grid items with a grid-area value will adjust their size to fit the specified grid area automatically. Multiple Choice: The place-items property in CSS is a shorthand for which two individual properties? A) justify-self and align-self B) align-items and justify-items C) align-content and justify-content D) grid-auto-flow and grid-template-columns

Correct Answer: B) align-items and justify-items

Rationale: The place-items property is a shorthand for setting both the align-items and justify-items properties in CSS. Fill-in-the-Blank: The grid-gap property in CSS is used to specify the __ between grid rows and columns.

Correct Answer: spacing

Rationale: The grid-gap property defines the spacing between rows and columns in a CSS grid layout.

Rationale: The grid-template-rows property determines the size of explicitly defined rows in a CSS grid layout.

  1. Multiple Choice: In the context of positioning grid elements, which CSS property is commonly used to control the positioning of an element within a grid? A) grid-column B) grid-area C) grid-row D) grid-template

Correct Answer: B) grid-area

Rationale: The grid-area property specifies a grid item's size, location, and name within a grid layout, allowing for precise positioning.

  1. Fill-in-the-Blank: To position an element in the second row and first column of a grid, the CSS declaration would be: grid-area: _________.

Correct Answer: 2 / 1

Rationale: The format for the grid-area property is row-start / column- start / row-end / column-end, so "2 / 1" would position the element in the second row and first column.

  1. True/False: The justify-self property in CSS Grid is used to align the content of a grid item along the inline axis.

Correct Answer: False

Rationale: justify-self in CSS Grid is used to align the item inside its grid area along the inline axis. To align the content along the block axis, you would use the align-self property.

  1. Multiple Choice: Which CSS property can be used to override the placement of a grid item within the grid? A) order B) position C) justify-items D) grid-auto-flow

Correct Answer: A) order

Rationale: The order property in CSS can be used to re-arrange grid items, allowing for custom positioning within the grid layout.

  1. Fill-in-the-Blank: When using the grid-auto-flow property in CSS Grid with the value "row dense", items are packed _______ in the grid.

Correct Answer: tightly

Correct Answer: stretch

Rationale: The keyword stretch is used with the align-self property in CSS to make a grid item stretch to fill the entire space within its grid area.

  1. True/False: The grid-column-gap property allows for defining the spacing between columns in a grid layout.

Correct Answer: True

Rationale: The grid-column-gap CSS property specifies the size of the gap between the columns in a grid layout.

  1. Multiple Choice: Which CSS function can be used to specify the location and size of the grid items using line-based placement? A) repeat() B) minmax() C) span() D) grid()

Correct Answer: C) span()

Rationale: The span() function in CSS Grid is used to specify the location and size of grid items by indicating how many grid tracks a particular item should span.

1 1. Fill-in-the-Blank: In a grid container, the CSS property grid-template- rows is used to define the _______ of the grid rows.

Correct Answer: height

Rationale: The grid-template-rows property in CSS is used to define the height of the rows in a grid layout.

  1. True/False: Using the grid-column-start property, it is possible to set a grid item to start on a specific grid line within the grid container.

Correct Answer: True

Rationale: The grid-column-start property in CSS Grid allows you to set a grid item to start on a specific grid line within the grid container.

  1. Multiple Choice: When using the grid-auto-rows property in CSS Grid, what happens if the specified size is insufficient for the content? A) Content overflows the grid item B) Grid item expands in height to accommodate the content C) Content is hidden D) Grid item shrinks to fit the content

Correct Answer: B) Grid item expands in height to accommodate the

content