如何将每两个按钮放在一行上,并在每行之间分隔边框?

发布于 2025-01-17 11:07:17 字数 691 浏览 5 评论 0原文

我在 Angular 8 上工作,我需要使用它来进行网页设计 html 和 css 或 bootstrap

我面临的问题是如何将每两个 button 放在

一起并带有边框,并在完成第一行后

转到带有新按钮的新行。

我尝试什么

<input 
    hidden 
    type="file" 
/>

<button >
    Upload
</button>

<div style="width:400px;">
    <div style="float: left; width: 130px"> 
        <button
    color="primary">
    Download Template
</button>
    </div>
    <div style="float: right; width: 225px"> 
        <button
    color="primary">
    Export
</button>
    </div>
</div>

I work on angular 8 I need to make web page design using
html and css or bootstrap

my issue i face how to put every two buttons beside

each other with border and after finish first row

go to new row with new buttons .

buttons with arrange

what i try

<input 
    hidden 
    type="file" 
/>

<button >
    Upload
</button>

<div style="width:400px;">
    <div style="float: left; width: 130px"> 
        <button
    color="primary">
    Download Template
</button>
    </div>
    <div style="float: right; width: 225px"> 
        <button
    color="primary">
    Export
</button>
    </div>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左岸枫 2025-01-24 11:07:17

使用显示:在行上的flex 将每一行分为两列,width 50%在行儿童上。

然后,您可以将边框应用于行。

.row {
  border-bottom: 1px solid black;
  display: flex;
  padding: 10px 0;
}

.row:first-child {
  border-top: 1px solid black;
}

.row div {
  width: 50%;
}
<div class="row">
  <input type="file"/>
</div>
<div class="row">
  <div><button>Button</button></div>
  <div><button>Button</button></div>
</div>
<div class="row">
  <div><button>Button Name</button></div>
  <div><button>Button</button></div>
</div>
<div class="row">
  <div><button>Button Long Name</button></div>
  <div><button>Button</button></div>
</div>

Split each row into two columns using display: flex on the row and width 50% on the row children.

Then you can apply a border to the row.

.row {
  border-bottom: 1px solid black;
  display: flex;
  padding: 10px 0;
}

.row:first-child {
  border-top: 1px solid black;
}

.row div {
  width: 50%;
}
<div class="row">
  <input type="file"/>
</div>
<div class="row">
  <div><button>Button</button></div>
  <div><button>Button</button></div>
</div>
<div class="row">
  <div><button>Button Name</button></div>
  <div><button>Button</button></div>
</div>
<div class="row">
  <div><button>Button Long Name</button></div>
  <div><button>Button</button></div>
</div>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文