gpt4 book ai didi

html - 窗体中的右对齐按钮

转载 作者:太空宇宙 更新时间:2023-11-04 07:51:42 25 4
gpt4 key购买 nike

我在使用 float 时遇到了一些问题:对;在按钮上。

无论我做什么,按钮就是不想转到右边。这是第二个按钮,带有“高级搜索按钮”类的按钮。

我正在使用 Bootstrap 4。

HTML

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="box">
<div class="box-title w-100">
<h5>Opgaver</h5>
</div>
<div class="box-form w-100">
<form action="" class="form-inline">
<div class="form-group form-group-custom">
<input type="text" class="form-control" placeholder="Rekvirent">
</div>
<div class="form-group form-group-custom">
<input type="text" class="form-control" placeholder="Tildelt til">
</div>
<div class="form-group form-group-custom">
<select name="select_Afsluttet" id="select_Afsluttet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Afsluttet</option>
<option value="">Ja</option>
<option value="">Nej</option>
<option value="">Alle</option>
</select>
</div>
<div class="form-group form-group-custom">
<select name="select_Godkendt" id="select_Godkendt" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Godkendt</option>
<option value="">Ja</option>
<option value="">Nej</option>
<option value="">Alle</option>
</select>
</div>
<div class="form-group form-group-custom float-sm-right">
<button type="button" class="btn btn-success btn-sm" style="margin-right: 15px;">Søg</button>
<button type="button" class="btn btn-primary btn-sm advanced-search-button" onclick="advancedSearch(this)">Avanceret søgning</button>
</div>
</form>
<form action="" class="form-inline form-custom advanced-search">
<div class="form-group form-group-custom">
<select name="select_Prioritet" id="select_Prioritet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Prioritet</option>
<option value="">Lav</option>
<option value="">Middel</option>
<option value="">Høj</option>
<option value="">Straks</option>
<option value="">Driftfejl</option>
</select>
</div>
<div class="form-group form-group-custom">
<select name="select_Opgavestatus" id="select_Opgavestatus" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Opgavestatus</option>
<option value="">Arkiveret</option>
<option value="">Sendt til DUC</option>
<option value="">Venter på bruger</option>
<option value="">Venter på kunde</option>
<option value="">Venter på AO</option>
</select>
</div>
<div class="form-group form-group-custom">
<select name="select_Opgavetype" id="select_Opgavetype" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Opgavetype</option>
<option value="">Andet</option>
<option value="">Sendt til DUC</option>
<option value="">Venter på bruger</option>
<option value="">Venter på kunde</option>
<option value="">Venter på AO</option>
</select>
</div>
<div class="form-group form-group-custom">
<select name="select_Underkategori" id="select_Underkategori" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Underkategori</option>
<option value="">Via telefon</option>
<option value="">Via email</option>
<option value="">Internet</option>
<option value="">Intranet</option>
<option value="">VMS</option>
</select>
</div>
<div class="form-group form-group-custom">
<input type="text" class="form-control" placeholder="Søg efter">
</div>
</form>
</div>
<div class="box-content">
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">Dato</th>
<th scope="col">ID</th>
<th scope="col">Rekv</th>
<th scope="col">Tildelt</th>
<th scope="col">Beskrivelse</th>
<th scope="col">Type</th>
<th scope="col">Seneste log besked</th>
<th scope="col">Deadline</th>
</tr>
</thead>
<tbody>
<tr>
<td>22-11-2017</td>
<td>70935</td>
<td>HJR</td>
<td>LUC</td>
<td>Docking Station...</td>
<td>Bestilling - Via Telefon</td>
<td>8 dage</td>
<td>22-11-2017</td>
</tr>
<tr>
<td>28-11-2017</td>
<td>71049</td>
<td>LLJ</td>
<td>LUC</td>
<td>Kan ikke scanne fra sin printe....</td>
<td>IT-Drift - Via Telefon</td>
<td>3 dage</td>
<td>28-11-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
</tbody>
</table>
</div>
</div>

我希望你能帮助我:)

这部分我没有任何自定义 CSS,我只使用 JS 的类。

最佳答案

你可以用 Flexbox 做这样的事情:

.flex-container {display:flex} /* displays children inline by default */

.flex-item {
display: flex;
justify-content: space-between; /* horizontal alignment / creates the max. horizontal space between the buttons */
flex: 1 !important; /* takes all the remaining horizontal space / needs to have the !important keyword otherwise it doesn't work */
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>

<div class="box">
<div class="box-title w-100">
<h5>Opgaver</h5>
</div>
<div class="box-form w-100">
<form action="" class="form-inline flex-container">
<div class="form-group form-group-custom">
<input type="text" class="form-control" placeholder="Rekvirent">
</div>
<div class="form-group form-group-custom">
<input type="text" class="form-control" placeholder="Tildelt til">
</div>
<div class="form-group form-group-custom">
<select name="select_Afsluttet" id="select_Afsluttet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Afsluttet</option>
<option value="">Ja</option>
<option value="">Nej</option>
<option value="">Alle</option>
</select>
</div>
<div class="form-group form-group-custom">
<select name="select_Godkendt" id="select_Godkendt" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Godkendt</option>
<option value="">Ja</option>
<option value="">Nej</option>
<option value="">Alle</option>
</select>
</div>
<div class="form-group form-group-custom flex-item">
<button type="button" class="btn btn-success btn-sm" style="margin-right: 15px;">Søg</button>
<button type="button" class="btn btn-primary btn-sm advanced-search-button" onclick="advancedSearch(this)">Avanceret søgning</button>
</div>
</form>

<form action="" class="form-inline form-custom advanced-search">
<div class="form-group form-group-custom">
<select name="select_Prioritet" id="select_Prioritet" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Prioritet</option>
<option value="">Lav</option>
<option value="">Middel</option>
<option value="">Høj</option>
<option value="">Straks</option>
<option value="">Driftfejl</option>
</select>
</div>
<div class="form-group form-group-custom">
<select name="select_Opgavestatus" id="select_Opgavestatus" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Opgavestatus</option>
<option value="">Arkiveret</option>
<option value="">Sendt til DUC</option>
<option value="">Venter på bruger</option>
<option value="">Venter på kunde</option>
<option value="">Venter på AO</option>
</select>
</div>
<div class="form-group form-group-custom">
<select name="select_Opgavetype" id="select_Opgavetype" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Opgavetype</option>
<option value="">Andet</option>
<option value="">Sendt til DUC</option>
<option value="">Venter på bruger</option>
<option value="">Venter på kunde</option>
<option value="">Venter på AO</option>
</select>
</div>
<div class="form-group form-group-custom">
<select name="select_Underkategori" id="select_Underkategori" class="custom-select mb-2 mr-sm-2 mb-sm-0">
<option selected hidden value="">Underkategori</option>
<option value="">Via telefon</option>
<option value="">Via email</option>
<option value="">Internet</option>
<option value="">Intranet</option>
<option value="">VMS</option>
</select>
</div>
<div class="form-group form-group-custom">
<input type="text" class="form-control" placeholder="Søg efter">
</div>
</form>
</div>

<div class="box-content">
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">Dato</th>
<th scope="col">ID</th>
<th scope="col">Rekv</th>
<th scope="col">Tildelt</th>
<th scope="col">Beskrivelse</th>
<th scope="col">Type</th>
<th scope="col">Seneste log besked</th>
<th scope="col">Deadline</th>
</tr>
</thead>
<tbody>
<tr>
<td>22-11-2017</td>
<td>70935</td>
<td>HJR</td>
<td>LUC</td>
<td>Docking Station...</td>
<td>Bestilling - Via Telefon</td>
<td>8 dage</td>
<td>22-11-2017</td>
</tr>
<tr>
<td>28-11-2017</td>
<td>71049</td>
<td>LLJ</td>
<td>LUC</td>
<td>Kan ikke scanne fra sin printe....</td>
<td>IT-Drift - Via Telefon</td>
<td>3 dage</td>
<td>28-11-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
<tr>
<td>05-12-2017</td>
<td>71244</td>
<td>LYL</td>
<td>LUC</td>
<td>Printer med gul baggrund på hy....</td>
<td>IT-support - Via Telefon</td>
<td>1 dage</td>
<td>05-12-2017</td>
</tr>
</tbody>
</table>
</div>
</div>

我通过添加两个额外的类(.flex-container.flex-item)并应用某些flex 具有适当值的属性。

我将 .flex-container 类应用于 form 元素,它是所有 .form-group/ 的父元素>.form-group-custom div 和 .flex-item 类到 button 的父级。

关于html - 窗体中的右对齐按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47713973/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com