place-items
Quick Summary for place-items
The CSS place-items shorthand property allows you to align items along both the block and inline directions at once (i.e. the align-items and justify-items properties) in a relevant layout system such as Grid or Flexbox. If the second value is not set, the first value is also used for it.
Code Usage for place-items
/* Keyword values */ place-items: center; place-items: normal start;  /* Positional alignment */ place-items: center normal; place-items: start legacy; place-items: end normal; place-items: self-start legacy; place-items: self-end normal; place-items: flex-start legacy; place-items: flex-end normal; place-items: left legacy; place-items: right normal;  /* Baseline alignment */ place-items: baseline normal; place-items: first baseline legacy; place-items: last baseline normal; place-items: stretch legacy;  /* Global values */ place-items: inherit; place-items: initial; place-items: revert; place-items: unset; 
More Details for place-items

place-items

The CSS place-items shorthand property allows you to align items along both the block and inline directions at once (i.e. the align-items and justify-items properties) in a relevant layout system such as Grid or Flexbox. If the second value is not set, the first value is also used for it.

Constituent properties

This property is a shorthand for the following CSS properties:

align-items justify-items

Syntax

/* Keyword values */ place-items: center; place-items: normal start;  /* Positional alignment */ place-items: center normal; place-items: start legacy; place-items: end normal; place-items: self-start legacy; place-items: self-end normal; place-items: flex-start legacy; place-items: flex-end normal; place-items: left legacy; place-items: right normal;  /* Baseline alignment */ place-items: baseline normal; place-items: first baseline legacy; place-items: last baseline normal; place-items: stretch legacy;  /* Global values */ place-items: inherit; place-items: initial; place-items: revert; place-items: unset; 

Values

One of the following forms:

A single align-items value, which is used to set alignment in both block and inline directions. An align-items value, which sets alignment in the block direction, followed by a justify-items value, which sets alignment in the inline direction.

Formal definition

Initial valueas each of the properties of the shorthand:align-items: normaljustify-items: legacy
Applies toall elements
Inheritedno
Computed valueas each of the properties of the shorthand:align-items: as specifiedjustify-items: as specified
Animation typediscrete

Formal syntax

<'align-items'> <'justify-items'>?

Examples

Placing items in a flex container

In flexbox justify-self or justify-items do not apply, as on the main axis items are treated as a group. Therefore, the second value will be ignored.

CSS
#container {   height:200px;   width: 240px;   place-items: stretch; /* You can change this value by selecting another option in the list */   background-color: #8c8c8c;   display: flex; }  
Result

Placing items in a grid container

The following grid container has items which are smaller than the grid areas they are placed in, therefore place-items will move them in the block and inline dimensions.

CSS
#gridcontainer {   height:200px;   width: 240px;   place-items: stretch; /* You can change this value by selecting another option in the list */   background-color: #8c8c8c;   display: grid;   grid-template-columns: repeat(3, 1fr); }  #gridcontainer > div {   width: 50px; }  
Result

Specifications

Specification
CSS Box Alignment Module Level 3 # place-items-property

See also

CSS Flexbox Guide: Basic Concepts of Flexbox CSS Flexbox Guide: Aligning items in a flex container CSS Grid Guide: Box alignment in CSS Grid layouts CSS Box Alignment The align-items property The align-self property The justify-items property The justify-self property

Last modified: Feb 4, 2022, by MDN contributors

Select your preferred language English (US)Français日本語Русский中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote

"Olivia, my eldest daughter, caught measles when she was seven years old. As the illness took its usual course I can remember reading to her often in bed and not feeling particularly alarmed about it. Then one morning, when she was well on the road to recovery, I was sitting on her bed showing her how to fashion little animals out of coloured pipe-cleaners, and when it came to her turn to make one herself, I noticed that her fingers and her mind were not working together and she couldn’t do anything. 'Are you feeling all right?' I asked her. 'I feel all sleepy,' she said. In an hour, she was unconscious. In twelve hours she was dead. The measles had turned into a terrible thing called measles encephalitis and there was nothing the doctors could do to save her. That was...in 1962, but even now, if a child with measles happens to develop the same deadly reaction from measles as Olivia did, there would still be nothing the doctors could do to help her. On the other hand, there is today something that parents can do to make sure that this sort of tragedy does not happen to a child of theirs. They can insist that their child is immunised against measles. ...I dedicated two of my books to Olivia, the first was ‘James and the Giant Peach’. That was when she was still alive. The second was ‘The BFG’, dedicated to her memory after she had died from measles. You will see her name at the beginning of each of these books. And I know how happy she would be if only she could know that her death had helped to save a good deal of illness and death among other children."

I just checked google books for BFG, and the dedication is there. 

https://www.google.com.au/books/edition/_/quybcXrFhCIC?hl=en&gbpv=1 


Roald Dahl, 1986
Random CSS Property

shape-margin

The shape-margin CSS property sets a margin for a CSS shape created using shape-outside.
shape-margin css reference