Open In App

Blaze UI Centered Alignment

Blaze UI is a free open source UI Toolkit that provides a great structure for building websites quickly with a scalable and maintainable foundation. All components in Blaze UI are developed mobile-first and rely solely on native browser features, not a separate library or framework. It helps us to create a scalable and responsive website fast and efficiently with a consistent style.

In this article, we will learn about Blaze UI Centered Alignment. It is used to place the content at the center whether horizontally / vertically / or both.



Used Classes:

Syntax



<div class="u-center-block ">
     <div class="u-center-block__content">Content</div>
</div>

Example 1: In this example, we will write some text.  The text written inside a div with class u-center-block__content will be center-aligned vertically as well as horizontally. We have used background colors for your better understanding.




<!DOCTYPE html>
<html>
  
<head>
    <link rel="stylesheet" href=
</head>
  
<body>
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
      
    <h3> Blaze UI Alignment Centered</h3>
      
    <div class="u-center-block " 
        style="background: pink;width:50%">
        Hi Geek!!
        <br><br>
        <div class="u-center-block__content" 
            style="background: yellow;">
            GeeksforGeeks
        </div>
    </div>
</body>
  
</html>

Output:

 

The yellow-colored div is center aligned horizontally as well as vertically.

Example 2: In this example, we will show how we can center align a div containing an image as well as a <p> tag, vertically as well as horizontally.




<!DOCTYPE html>
<html>
  
<head>
    <link rel="stylesheet" href=
</head>
  
<body>
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
      
    <h3> Blaze UI Alignment Centered</h3>
      
    <div class="u-center-block " 
        style="background:pink; height:400px;width:50%">
        <div class="u-center-block__content">
              
<p>GeeksforGeeks</p>
  
            <img src=
                height=100px width=100px />
        </div>
    </div>
</body>
  
</html>

Output:

 

Reference: https://www.blazeui.com/utils/alignment/


Article Tags :