Css3 Pr Justify Content
π
2026-06-18 | π CSS
CSS justify-content Property | \n \n \n body { font-family: Arial, sans-serif; line-height: 1.6; margin: 20px; }\n h1 { color: #333; }\n h2 { color: #444; border-bottom: 1px solid #eee; padding-bottom: 5px; }\n .example { background: #f9f9f9; border: 1px solid #ddd; padding: 15px; margin: 10px 0; border-radius: 5px; }\n .note { background: #fff3cd; border: 1px solid #ffeeba; padding: 10px; margin: 10px 0; border-radius: 5px; }\n table { border-collapse: collapse; width: 100%; margin: 10px 0; }\n th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }\n th { background-color: #f2f2f2; }\n code { background-color: #f1f1f1; padding: 2px 4px; border-radius: 3px; font-family: monospace; }\n pre { background-color: #f1f1f1; padding: 10px; border-radius: 5px; overflow-x: auto; }\n \n\n
CSS justify-content Property
\n\n
Definition and Usage
\n
justify-content property is used to set the alignment of items within the container along the main axis in a flexbox layout.
\n\n
Syntax
justify-content: flex-start | flex-end | center | space-between | space-around | space-evenly | initial | inherit;
Property Values
\n
\n \n | Value | \n Description | \n
\n \n flex-start | \n Default. Items are placed at the beginning of the container. | \n
\n \n flex-end | \n The item is located at the end of the container. | \n
\n \n center | \n The item is centered in the container. | \n
\n \n space-between | \n Items have equal space between them. The first item is at the start line, and the last item is at the end line. | \n
\n \n space-around | \n The spacing on both sides of each item is equal. Note that the spacing between adjacent items is twice the spacing between the item and the edge. | \n
\n \n space-evenly | \n The spacing between items (including between items and edges) is exactly equal. | \n
\n \n initial | \n Set this property to its default value. | \n
\n \n inherit | \n Inherits this property from its parent element. | \n
\n
\n\n
\n Note: This property is only effective in Flexbox layout (when\n
display: flex or
display: inline-flextime).\n
\n\n
Examples
\n\n
1. justify-content: flex-start (default)
\n
\n
Items are placed at the start of the container.
.container {\n display: flex;\n justify-content: flex-start;\n}
\n\n
2. justify-content: flex-end
\n
\n
Items are aligned at the end of the container.
.container {\n display: flex;\n justify-content: flex-end;\n}
\n\n
3. justify-content: center
\n
\n
Items are positioned at the center of the container.
.container {\n display: flex;\n justify-content: center;\n}
\n\n
4. justify-content: space-between
\n
\n
Equal spacing is distributed between items. The first item is on the start line, and the last item is on the end line.
.container {\n display: flex;\n justify-content: space-between;\n}
\n\n
5. justify-content: space-around
\n
\n
The spacing on both sides of each item is equal. Note that the spacing between adjacent items is twice the spacing between an item and the edge.
.container {\n display: flex;\n justify-content: space-around;\n}
\n\n
6. justify-content: space-evenly
\n
\n
The spacing between items (including between items and edges) is completely equal.
.container {\n display: flex;\n justify-content: space-evenly;\n}
\n\n
Browser Support
\n
\n \n | Attribute | \n Chrome | \n Edge | \n Firefox | \n Safari | \n Opera | \n
\n \n justify-content | \n 29.0+ | \n 12.0+ | \n 28.0+ | \n 9.0+ | \n 17.0+ | \n
\n
\n\n
\n