CSS Properties: How to align item?
Solution:
HTML Code:
Explanation:
- The HTML code creates a container div with the ID "xyz" and three nested divs.
- Each nested div has a different background color and content.
- CSS is used to style the container div and its child divs, including setting width, height, border, and flexbox properties.
- Flexbox properties are applied to align the child divs vertically at the center using the align-items: center; property.
- Both WebKit and other browsers are targeted with appropriate prefixes to ensure cross-browser compatibility.
Live Demo:
See the solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | No |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics