Open In App

CSS place-self Property

The CSS place-self property is the shorthand of align-self and justify-self property. A shorthand property in CSS means you can set the multiple properties values in a single property. Here the place-self property can hold the value of the align-self and justify-self property.

Syntax:



place-self: align-self-property-value justify-self-property-value

Property Values: This property accepts all the possible combination values that can make by the align-items and justify-items property values.

Below examples illustrate the CSS place-self property:



Example 1:




<!DOCTYPE html>
<html>
  
<head>
    <title>CSS place-self Property</title>
    <style>
        h1 {
            color: green;
        }
  
        article {
            background-color: black;
            display: grid;
            grid-auto-rows: 40px;
            grid-gap: 5px;
            width: 200px;
        }
  
        /* Using different values
    with the place-self property */
        span:nth-child(2) {
            place-self: start center;
        }
  
        span:nth-child(3) {
            place-self: center start;
        }
  
        article span {
            background-color: orange;
            color: white;
            margin: 1px;
            text-align: center;
        }
  
        article,
        span {
            padding: 6px;
            border-radius: 5px;
        }
    </style>
</head>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <b>CSS place-self Property</b>
        <article class="container">
            <span>HTML</span>
            <span>CSS</span>
            <span>Bootstrap</span>
            <span>JavaScript</span>
        </article>
    </center>
</body>
  
</html>

Output:

Example 2:




<!DOCTYPE html>
<html>
  
<head>
    <title>CSS place-self Property</title>
    <style>
        h1 {
            color: green;
        }
  
        article {
            background-color: black;
            display: grid;
            grid-auto-rows: 40px;
            grid-gap: 5px;
            width: 200px;
        }
  
        /* Using different values
        with the place-self property */
        span:nth-child(2) {
            place-self: self-start;
        }
  
        span:nth-child(3) {
            place-self: self-end;
        }
  
        article span {
            background-color: orange;
            color: white;
            margin: 1px;
            text-align: center;
        }
  
        article,
        span {
            padding: 6px;
            border-radius: 5px;
        }
    </style>
</head>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <b>CSS place-self Property</b>
        <article class="container">
            <span>HTML</span>
            <span>CSS</span>
            <span>Bootstrap</span>
            <span>JavaScript</span>
        </article>
    </center>
</body>
  
</html>


Output:

Article Tags :