center image jsx css 1

center image jsx css

.center{
    text-align: center;
    display: block;
    justify-content: center;
    align-items: center;
    margin: auto;
    width: 100%;
  }

Here is what the above code is Doing:
1. We’re creating a class called center.
2. We’re telling the browser that the text inside the class should be centered.
3. We’re telling the browser that the class should be displayed as a block.
4. We’re telling the browser that the class should be justified to the center.
5. We’re telling the browser that the class should be aligned to the center.
6. We’re telling the browser that the class should be centered horizontally.
7. We’re telling the browser that the class should be 100% of the width of the page.

Now, let’s add the class to our HTML code:

Hello World!

Now, when you refresh the page, you should see the text centered.

Similar Posts