Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizPlease log in to access this content. You will be redirected to the login page shortly.
LoginHow to display flex items horizontally in Bootstrap?
Web Development Bootstrap in Web Development 3 years ago
With Bootstrap, it’s possible to display FLEX items horizontally using the .flex-row class.
You need to use the following:
<div class="d-flex flex-row bg-secondary mb-3">Above, we have used the contextual class “bg-secondary” for background color.
Now, we will work on an example:
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link REL="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"> <script SRC="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script> </head> <body> <div class="CONTAINER mt-3"> <h1>Student Name</h1> <div class="d-flex flex-row bg-primary mb-3"> <div class="p-2 bg-danger">Sehral</div> <div class="p-2 bg-primary">Fara</div> <div class="p-2 bg-dark">Kelly</div> <div class="p-2 bg-secondary">Gemma</div> <div class="p-2 bg-warning">Jessica</div> <div class="p-2 bg-primary">Lauren</div> </div> </div> </body> </html>The above aligns the flex items horizontally:
To display flex items horizontally, use the flex-*-row class in Bootstrap. For difference screens, replace the * in the class name with the following:
For large screen:
flex-lg-rowFor medium size screen:
flex-md-rowFor SMALL screen:
flex-sm-rowPosted on 31 May 2022, this text provides information on Web Development related to Bootstrap in Web Development. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.