无法在 bootstrap 中更改模态关闭按钮的位置

not able to change position of modal close button in bootstrap

我有一个 bootstrap 模式,它有一个关闭按钮,如下所示:

<button type="button" id="aloshimandan" class="close" data-dismiss="modal" style="right:7px;position: relative;top:7px;z-index: 1;margin-top:3%;">&times;</button>

按钮在模态主体内,按钮出现在模态上方一点,无法将其向下移动。我尝试了 marggin-top 属性 等等,给了它重要的属性,但它仍然没有移动。谁能告诉我这里可能出了什么问题,在此先感谢

如您所见,可以使用 CSS 轻松操作按钮。更多关于 Bootstrap 4 模态的信息 https://getbootstrap.com/docs/4.0/components/modal/#live-demo

.modal-content .modal-header .close {
  margin-right: 10px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- needs for bootstrap .popper() -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.js"></script>
<!-- bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/js/bootstrap.min.js"></script>

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>