🎁 The Js-Craft Guide to React is now available with a 30% off discount!

Place-Items and CSS Grid – centering content in cells

New day, new CSS property discovered 🎉.

This time was place-items a shorthand for the align-items and justify-items properties.

We can very easily center the contents in CSS grid cells by saying:

.my-grid-element {
    display: grid;
    place-items: center;
    /* place-items replaces the following:
    align-items: center;
    justify-items: center; */
}

Place-items and place-content

There is a very similar property to place-items named place-content.

Keep in mind that place-items and place-content differ in their function:

  • place-items sets the position of each item relative to the container
  • while place-content sets the position of the content inside each item relative to its container.

The place-items prop is typically used for grid layouts, whereas place-content is more commonly used for positioning blocks of text or images.

You can checkout the below video of Kevin Powell for a more in-depth comparison:

10 Javascript AI projects with Langchain & React

Not sure what to build? Dive in with these Javascript AI projects! Learn how to build LLM powered apps using Langchain.js and React! Connect your apps to LLMs such as OpenAI, create agents, use vector databases, or setup AI context.

10 Javascript AI projects with Langchain & React

Not sure what to build? Dive in with these Javascript AI projects! Learn how to build LLM powered apps using Langchain.js and React! Connect your apps to LLMs such as OpenAI, create agents, use vector databases, or setup AI context.


Leave a Reply

Your email address will not be published. Required fields are marked *

📘 The Guide to React Home Screencasts Best of Newsletter Search X

📘 - 10 Javascript AI projects with React and LangChain

Hi friend! Before you go, just wanted to let you know about the 10 Javascript AI projects ideas with React and LangChain FREE ebook.

One of the best ways to learn is by doing the work. Choose from these 10 project ideas and start working on topics such as:

  • How does LangChain work
  • Connecting to OpenAI LLM
  • Create AI Agents
  • Simple and Sequential Chains
  • Adding Memory (Chat Context)
  • Prompt Templates
  • Using OutputParsers and Tools for Agents
  • Work with Documents and more...

Keep building and see the new capabilities LLM models can add to your React app! Get all projects as an ebook right to your inbox!

X