How would you align the content of a grid item along the block (column) axis?
- align-content: center;
- align-items: center;
- align-self: center;
- justify-content: center;
To align the content of a grid item along the block (column) axis, you should use the 'align-content' property. 'align-content' aligns the items within the grid container along the block axis, such as centering them vertically. 'justify-content' and 'align-items' are used for the main and inline axes, respectively. 'align-self' is used to control the alignment of individual grid items.
You are tasked with creating a vintage look for images on a webpage. Which CSS filter or combination of filters would you likely use?
- filter: blur(5px) opacity(0.7);
- filter: grayscale(100%) brightness(1.2) hue-rotate(90deg);
- filter: invert(100%) contrast(1.2) sepia(100%);
- filter: sepia(100%) contrast(0.8) brightness(0.8) saturate(1.5);
To create a vintage look for images, you can use CSS filters. The combination sepia(100%) contrast(0.8) brightness(0.8) saturate(1.5) would add a sepia tone, reduce contrast, lower brightness, and slightly increase saturation, giving the image a vintage appearance.
Which display value would you use to hide an element but keep its space in the layout?
- display: block;
- display: hidden;
- display: invisible;
- display: none;
To hide an element but maintain its space in the layout, you would use 'display: none;'. This property effectively removes the element from the display, but it still occupies space, which can be useful for various purposes.
What is the primary purpose of the letter-spacing property in CSS?
- Adjust the space between letters in text
- Change the font of text
- Change the font size
- Change the text color
The primary purpose of the letter-spacing property in CSS is to adjust the space between letters in text. It allows you to increase or decrease the space between characters, making text more tightly packed or more spaced out, which can be useful for achieving specific design or typographic effects.
If you have a CSS rule with !important and another rule with higher specificity targeting the same element, which one will take precedence?
- Both rules will be applied
- The order in the stylesheet
- The rule with !important
- The rule with higher specificity
If a CSS rule has the !important declaration, it takes the highest precedence, regardless of the specificity of other rules. The !important rule will override any conflicting rule, even if it has a higher specificity.
In SASS/SCSS, how do you define a mixin?
- #mixin myMixin() { }
- &mixin myMixin() { }
- @mixin myMixin() { }
- def mixin myMixin():
In SASS/SCSS, a mixin is defined using the @mixin directive followed by the mixin name and parentheses. The correct syntax is @mixin myMixin() { ... }. Mixins are used to encapsulate reusable sets of styles and can take parameters inside the parentheses if needed.
When using float, what happens to the element's position in the normal document flow?
- It becomes a flex item.
- It becomes a grid item.
- It remains in the normal document flow.
- It's removed from the document flow.
When you apply the CSS float property to an element, it is removed from the normal document flow. This means that other elements may flow around it as if it doesn't occupy space.
In the CSS box model, the ________ area is the space where content, like text or images, is displayed.
- Border
- Content
- Margin
- Padding
In the CSS box model, the "content" area is the space where content, such as text or images, is displayed. This is the innermost part of an element's layout and is surrounded by padding, border, and margin.
You have an element with a complicated graphical background, and you want certain parts of the foreground content to reveal or hide portions of this background. Which CSS technique would be most appropriate to achieve this?
- background-clip: text;
- opacity: 0.5;
- visibility: hidden;
- z-index: -1;
To reveal or hide portions of the background based on the foreground content, you can use background-clip: text;. This property allows the background to show through the text or other foreground elements, creating an interesting visual effect.
Which CSS property adjusts the space between lines of text?
- line-height
- line-spacing
- text-spacing
- word-spacing
The CSS property that adjusts the space between lines of text is "line-height." It is used to control the vertical space between lines, making text more readable and aesthetically pleasing. A larger value increases the line spacing, while a smaller value decreases it.