gpt4 book ai didi

html - 在折叠 Bootstrap 中对齐按钮和文本

转载 作者:行者123 更新时间:2023-11-28 18:21:23 33 4
gpt4 key购买 nike

我尝试使用元素 Collapse in Bootstrap但我有一点问题。

这是一个例子的图像 enter image description here

我尝试将我的文本和我的垃圾按钮对齐在同一行中。如您所见,它发生了移动。

如何解决这个问题?

<form method="post" action="wbx.php">
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
<button class="btn btn-danger pull-right" type="submit" name="supprAlias" value="'.$idValue.'">
<i class="icon-trash icon-white"></i>
</button>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
Collapsible Group Item #2</a>
<button class="btn btn-danger pull-right" type="submit" name="supprAlias" value="'.$idValue.'">
<i class="icon-trash icon-white"></i>
</button>

</div>
<div id="collapseTwo" class="accordion-body collapse">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>
</div>
</form>

在另一个页面的我的 Controller 中:

if(!empty($_POST['supprUserAlias']))
{
$savant->deletesUserAlias = $gemel->setDeleteUserAlias($_POST['supprUserAlias'], $username, $domain, $serverMail);
header('Location: wbx.php?user='.$username.'#alias');
exit;
}

编辑

终于找到解决办法了:

<button><div class="accordion-group"> 之间和 <div class="accordion-heading">

<form method="post" action="wbx.php">
<div class="accordion" id="accordion2">
<div class="accordion-group">
<button class="btn btn-danger pull-right" type="submit" name="supprAlias" value="'.$idValue.'">
<i class="icon-trash icon-white"></i>
</button>
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1
</a>
</div>
<div id="collapseOne" class="accordion-body collapse in">
<div class="accordion-inner">
Anim pariatur cliche...
</div>
</div>
</div>

最佳答案

您只需要像这样将按钮放在链接 (a) 标记内。我认为您还应该使按钮更小 (btn-mini),以便它很好地适合折叠链接。

<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
Collapsible Group Item #1 <button class="btn btn-mini btn-danger pull-right" type="submit"><i class="icon-trash icon-white"></i></button>
</a>

Demo on Bootply

编辑-

按钮的点击可以这样处理..

$('.accordion-toggle .btn').click(function(e){
e.preventDefault();
alert("button!");
return false;
})

关于html - 在折叠 Bootstrap 中对齐按钮和文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16713755/

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