html - 右上角扩展按钮

标签 html css

我需要按照下图创建导航

enter image description here

我已经成功地向下 flex 了右上角,但我不知道如何延伸左上角。

enter image description here

这是我使用的CSS

   .btn-group > .btn:not(:last-child):not(.dropdown-toggle), .btn-group > .btn-group:not(:last-child) > .btn 
 {
    border-top-right-radius: 21px;
     border-bottom-right-radius: 0;
 }

最佳答案

据我所知,你无法扩展拐 Angular 。

但是,您可以使用 margin-left: -...pxz-index 使其正常工作。

.container {
  display: flex;
  background: gray;
  padding: 4px;
}

.nav-container {
  flex: 1;
}

.nav-container button {
  padding: 0 20px;
  height: 40px;
  border: 2px solid white;
  border-top-right-radius: 20px;
  margin-left: -20px; /* <--- THIS */
  position: relative;
}

.nav-container button:first-child {
  margin-left: 0;
  z-index: 2; /* <--- THIS */
}

.nav-container button:nth-child(2) {
  z-index: 1; /* <--- THIS */
}

.nav-container button:nth-child(3) {
  z-index: 0; /* <--- THIS */
}
.nav-container button:nth-child(odd) {
  background: #C38D8F;
}
.nav-container button:nth-child(even) {
  background: #CF1E22;
}
<div class="container">
  <div class="nav-container">
    <button>Home</button>
    <button>Partner</button>
    <button>Product</button>
  </div>
  <button>Log out</button>
</div>

关于html - 右上角扩展按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54977460/

相关文章:

html - 在 <td> 元素中使用类 - 样式

php - 如何显示同一个id的多条记录?

php - 动态改变 css 元素宽度

jquery - 如何处理嵌套列表的内部 LI 单击

javascript - 如何规范化 CSSStyleDeclaration 对象的单位?

html - 奇怪的 CSS 格式错误

ios - 在 Phonegap 中,HTML 不会随着应用程序的旋转而调整大小

jquery - 为什么在 slideFade 动画时有顶部边距?

css - Spring mvc 4 : cannot location css

css - 自动设置网页高度