接下来对齐导航栏下拉菜单项

时间:2020-01-09 12:03:16

标签: html css bootstrap-4

我正在尝试将Bootstrap 4制作的下拉项目彼此对齐,如下所示:

enter image description here

当鼠标悬停在第一个测试项目上时,项目1和2是下拉项目。

我尝试在CSS中使用try { var response = new HttpResponseMessage(HttpStatusCode.Redirect); response.Headers.Location = new Uri("cnn.com"); return response; } catch (Exception e) { ErrorSignal.FromCurrentContext().Raise(e); return Request.CreateResponse(HttpStatusCode.InternalServerError, e); } ,但不幸的是,该方法无法正常工作。 任何建议都将受到高度赞赏。

但是现在它们像这样在彼此的下面:

enter image description here

float: left

2 个答案:

答案 0 :(得分:0)

使用带有下拉项的 d-inline-block w-auto

答案 1 :(得分:0)

如果要并排排列下拉项,请使用此代码

.dropdown-menu a{
  display:inline;
  padding:5px;
}

OR

如果要逐行对齐下拉菜单项,请使用此代码

.dropdown-menu a{
  display:block;
  padding:5px;
}