Problem: Inline-Block Group Centering via text-align

easy
15 min
Try to center a group of inline-block elements within a container using the ‘text-align’ property.

Problem description

A wrapper element is 500px wide and contains two inline-block .item elements. The task is to center the group of .item elements within the wrapper so they appear together in the middle.

Goal

Group-center the inline-block items within the wrapper.

Constraints

You may only apply CSS to existing elements; adding extra wrappers or using scripts is not allowed.

Sample visual output

Here’s what the output would look like:

Good luck trying the problem! If you’re unsure how to proceed, check the Solution.

Problem: Inline-Block Group Centering via text-align

easy
15 min
Try to center a group of inline-block elements within a container using the ‘text-align’ property.

Problem description

A wrapper element is 500px wide and contains two inline-block .item elements. The task is to center the group of .item elements within the wrapper so they appear together in the middle.

Goal

Group-center the inline-block items within the wrapper.

Constraints

You may only apply CSS to existing elements; adding extra wrappers or using scripts is not allowed.

Sample visual output

Here’s what the output would look like:

Good luck trying the problem! If you’re unsure how to proceed, check the Solution.