如果你想要将10个按钮纵向排列,但每行只有一个按钮,你可以使用CSS的display: flexflex-direction: column属性来实现。

HTML代码:

<div class="button-container">
  <button>按钮1</button>
  <button>按钮2</button>
  <button>按钮3</button>
  <button>按钮4</button>
  <button>按钮5</button>
  <button>按钮6</button>
  <button>按钮7</button>
  <button>按钮8</button>
  <button>按钮9</button>
  <button>按钮10</button>
</div>

CSS代码:

.button-container {
  display: flex;
  flex-direction: column;
}

这样,按钮就会纵向排列,并且每行只有一个按钮。

css 10个按钮纵向排放一行只有1个按钮

原文地址: http://www.cveoy.top/t/topic/iZR5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录