html - 如果里面的文本很长,CSS按钮会被推出
问题描述
我有一个如下的按钮列表,以及它的 CSS
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 30px;
margin: 4px 2px;
cursor: pointer;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
width: 200px;
height:200px;
white-space: normal;
word-wrap: break-word;
}
.table_mgt, .inventory_mgt {
border-radius: 30px;
}
<h1>Dashboard</h1>
<div id="dashboard_menu">
<button class="button table1">Table 1</button>
<button class="button table2">Table 2</button>
<button class="button table_mgt">Table Mgt</button>
<button class="button table3">Table 3</button>
<button class="button table4">Table 4</button>
<button class="button table5">Table 5</button>
<button class="button inventory_mgt">Inventory</button>
</div>
按钮中的文本table_mgt
太长,与其他按钮相比,它会将该按钮推出行外。无论内部文本的长度如何,如何强制所有按钮位于同一行?
解决方案
添加到id#dashboard_menu{ display:flex;}
推荐阅读
- css - 样式复选框不显示检查 - 与另一个类
- android - 带有布局文件的自定义 ViewGroup
- maven - 无法使用 maven 运行多个 testng xml 文件
- sql - Oracle查询查找最近1个月休假次数最多的员工
- python - 熊猫 x-ticks 情节不起作用
- asp.net-mvc - 修改 bootstrap.min.css 和 bootstrap.min.css.map
- python - Python:实例的返回值
- c# - 如何将字典写入计算机并通过不同的方法读取?
- c++ - 为什么在使用 std::bind 时会调用两次复制 ctor?
- google-cloud-storage - Google Cloud Storage 500 内部服务器错误“Google::Cloud::Storage::SignedUrlUnavailable”