css - bootstrap 4 horizontal alignment of toggle fails -
i using toggle element of material design lite in bootstrap 4 framework , unable align element right side of column.
note "float-right" class works fine bootstrap element (button). tried applying "text-right" class container, justify-content-end, justify-content: flex-end, pull-right, etc... nothing works.
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet" /> <link href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css" rel="stylesheet" /> <body> <div class="container"> <div class="row"> <div class="col-8">text row 1</div> <div class="col-4 float-right"> <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect float-right" for="switch-1"> <input type="checkbox" id="switch-1" class="mdl-switch__input float-right" checked> </label> </div> </div> <div class="row"> <div class="col-8">text row 2</div> <div class="col-4 float-right"> <button type="button" class="btn btn-primary float-right">submit</button> </div> </div> </div> </div> </body>
how can align element right side of column? context trying layout similar settings in chrome (text left aligned, toggle right aligned):
with css rule can shifted on right. because it's floating you'll need play padding lined right. option putting controls in div.col-1
, giving them less space move around.
label.mdl-switch { width: auto !important; }
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet" /> <link href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css" rel="stylesheet" /> <body> <div class="container"> <div class="row"> <div class="col-8">text row 1</div> <div class="col-4 float-right"> <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect float-right" for="switch-1"> <input type="checkbox" id="switch-1" class="mdl-switch__input" checked> </label> </div> </div> <div class="row"> <div class="col-8">text row 2</div> <div class="col-4 float-right"> <button type="button" class="btn btn-primary float-right">submit</button> </div> </div> </div> </body>
Comments
Post a Comment