Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • BS5 Tutorial
  • BS5 Interview Questions
  • BS5 Layout
  • BS5 Content
  • BS5 Components
  • BS5 Helpers
  • BS5 Utilities
  • BS4 Tutorial
  • BS Tutorial
  • Bootstrap Cheatsheet
  • Tailwind
  • CSS Frameworks
  • HTML Formatter
Open In App
Next Article:
Bootstrap 5 Vertical Alignment
Next article icon

Bootstrap 5 Vertical Alignment

Last Updated : 04 Apr, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Bootstrap 5 Vertical Alignment facilitates aligning inline, inline-block, inline-table, and table cell elements vertically within their container. It offers classes for top, bottom, middle alignment, and stretching content to fill vertical space, enhancing layout flexibility in web development.

Bootstrap 5 Vertical Alignment Classes:

Class NameDescription
align-baselineAligns the baseline of the element with the baseline of its parent.
align-topAligns the top of the element with the top of the line.
align-middleAligns the middle of the element with the middle of the parent.
align-bottomAligns the bottom of the element with the bottom of the line.
align-text-bottomAligns the bottom of the element with the bottom of the parent element's text.
align-text-topAligns the top of the element with the top of the parent element's text.

Syntax:

<span class="align-top">....</span>

Examples of Bootstrap 5 Vertical Alignment

Example 1: This example shows the use of vertical alignment classes to align span elements inside a paragraph.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">      <!-- Bootstrap 5 - JavaScript CDN -->     <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js">     </script>     <!-- Bootstrap 5 - CSS CDN-->     <link href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"            rel="stylesheet" /> </head>  <body>     <div class="container text-center">         <div class="my-4">             <h4>Bootstrap 5 Vertical Alignment</h4>         </div>         <p>             <span class="align-top bg-info">                 GeeksforGeeks             </span>             <span class="align-baseline bg-warning">                 is a             </span>             <span class="align-middle bg-secondary">                 Computer             </span>             <span class="align-bottom bg-primary">                 Science             </span>             <span class="align-text-top bg-danger">                 Portal             </span>             <span class="align-text-bottom bg-success">                 for Geeks.             </span>         </p>     </div> </body>  </html> 

Output:

Bootstrap-vertical
Bootstrap 5 Vertical Alignment Example Output

Example 2: In this example, we show the use of the align-baseline, align-top, align-middle, and align-bottom classes using images.

HTML
<!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">      <!-- Bootstrap 5 - JavaScript CDN -->     <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js">     </script>     <!-- Bootstrap 5 - CSS CDN-->     <link href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"            rel="stylesheet" /> </head>    <body>     <div class="container text-center">         <div class="my-4">             <h5>Bootstrap 5 Vertical Alignment Using with Table Cells</h5>         </div>          <table class="table w-50 m-auto">             <thead>                 <tr>                     <th class="align-top">Align Top</th>                     <th class="align-baseline">Align Baseline</th>                     <th class="align-middle">Align Middle</th>                     <th class="align-baseline">Align Bottom</th>                 </tr>             </thead>              <tbody>                 <tr style="height: 80px;">                     <td class="align-top">Top</td>                     <td class="align-baseline">Baseline</td>                     <td class="align-middle">Middle</td>                     <td class="align-bottom">Bottom</td>                 </tr>             </tbody>         </table>     </div> </body> </html> 

Output:

BootstraoVertical-2
Bootstrap 5 Vertical Alignment Using table Cell Example Output


Next Article
Bootstrap 5 Vertical Alignment

V

vpsop
Improve
Article Tags :
  • Technical Scripter
  • Web Technologies
  • Bootstrap
  • Technical Scripter 2022
  • Bootstrap-5

Similar Reads

    Bootstrap 5 Table Vertical alignment
    What is Bootstrap Tables?Bootstrap Tables are this is useful to make tables and charts and it has a lot of customizable options and utilities thanks to the Bootstrap predefined styles. Bootstrap provides us with functionality that helps us to vertically align these table cells' contents. By default,
    3 min read
    Bootstrap 5 Columns Vertical Alignment
    Bootstrap 5 Columns Vertical alignment is used to change the alignment of the column's content in the vertical direction. Bootstrap5 Columns Vertical alignment classes: align-items-start: This class is used to align the column items to the start position. align-items-center: This class is used to al
    2 min read
    Bootstrap 5 Text Alignment
    Bootstrap 5 text alignment classes are used to realign components with the start, end, and center variation. It can be used in the same viewport width breakpoints as the grid system. iframe { width: 100%; height: 450px;} @media (max-width: 1145px) {.article--viewer .a-wrapper .content .text iframe {
    2 min read
    Bootstrap 5 Columns Alignment
    In bootstrap 5, we can use flexbox alignment utilities to align our columns horizontally and vertically without using CSS. The following are the possible alignment ways: Vertical alignment: For aligning the column vertically we use the flexbox utilities to get desired alignment system.Horizontal ali
    2 min read
    Bootstrap 5 Spinners Alignment
    Bootstrap 5 Spinners Alignment is used to set the alignment of the spinner element. The spinner element can easily be resized, recolored, and quickly aligned. Spinners Alignment: Margin Alignment: Spinner margin is used to create spinners in different margins.Spinners Placement: Spinners Placement i
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences