0

I want to move button at the end of right . Here is my code JSbin

    <div style="display: flex;justify-content: center;">
       <h3 style="font-weight: bold;">Back</h3>
        <div style="display: flex">
         <button class="btn btn-primary clearfix" ng-click="onRejectedReason()">Rejected Reason</button>
        </div>
   </div>

enter image description here

Sai Manoj
  • 3,809
  • 1
  • 14
  • 35
user944513
  • 12,247
  • 49
  • 168
  • 318

1 Answers1

2

you can set parent as display:flex;flex-direction: row and make h1 as flex-basis: 100%;

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">

</head>

<body>
  <div style=" display: flex;flex-direction: row; align-items: center;">
    <h3 style=" flex-basis: 100%;">Back</h3>

    <button class="btn btn-primary clearfix" ng-click="onRejectedReason()">Rejected Reason</button>

  </div>
</body>

</html>

Solution 2: You can insert a span element in between the div which you want to align right by applying flex: 1 1 auto .

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
</head>

<body>
  <div style="display: flex;justify-content:   justify-content: space-between;;">
    <h3 style="font-weight: bold;">Back</h3>
    <span style="flex: 1 1 auto;"></span>
    <div style="display: flex">
      <button class="btn btn-primary clearfix" ng-click="onRejectedReason()">Rejected Reason</button>
    </div>
  </div>
</body>

</html>
Sai Manoj
  • 3,809
  • 1
  • 14
  • 35