我使用Bootstrap 4做到了这一点,我想将按钮和复选框向右移动,但是我真的不知道该怎么做,有人可以帮我吗?

css - 如何使用Bootstrap 4向右移动按钮和复选框?-LMLPHP

HTML代码:

<div class="col-8">
<div class="form-group" style="text-align:right">
    <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" placeholder="Lascia anche tu una dedica sul profilo di @xdekus">
    </textarea>
    <div class="form-row align-items-center" style="margin-top:1%;text-align:right">
        <div class="col-auto">
            <button type="submit" class="btn" style="background-color: #5EBD63; color:white; cursor:pointer; margin-top:1%;">Invia</button>
        </div>
        <div class="col-auto">
            <label class="custom-control custom-checkbox" style="margin-bottom: 0px;">
                <input type="checkbox" class="custom-control-input">
                <span class="custom-control-indicator"></span>
                <span class="custom-control-description">Lascia la dedica in forma anonima.</span>
            </label>
        </div>
    </div>
</div>

最佳答案

试试下面的代码



<!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/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="col-8">
<div class="form-group" style="text-align:right">
    <textarea  class="form-control" id="exampleFormControlTextarea1" rows="3" placeholder="Lascia anche tu una dedica sul profilo di @xdekus"></textarea>
    <div class="form-row align-items-center" style="margin-top:1%;text-align:right">
        <div class="col-auto">
            <button type="submit" class="btn" style="background-color: #5EBD63; color:white; cursor:pointer; margin-top:1%;">Invia</button>

            <label class="custom-control custom-checkbox" style="margin-bottom: 0px;">
                <input type="checkbox" class="custom-control-input">
                <span class="custom-control-description">Lascia la dedica in forma anonima.</span>
            </label>
            </div>
    </div>
</div>

</div>
</body>
</html>

关于css - 如何使用Bootstrap 4向右移动按钮和复选框?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45672806/

10-11 13:11