Float an element to the right with Bootstrap 4

If you want to float an element on the right, you need to use the float-right class.

Set it on the right −

<div class="float-right">
  The text is on right!

Let us see an example to float element on the right −


Live Demo

<!DOCTYPE html>
<html lang="en">
  <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>


  <div class="container">
    <div class="clearfix">
      <div class="float-right">The text is on right!</div><br>
      <div class="float-left">This is demo text.</div><br>