CSS   发布时间:2022-04-17  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何使用css使这样的角度选项卡?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要这样做.是否可以用纯CSS?

解决方法

使用border-radius,before和transform:skew(…);
body {
  BACkground-color: #000;
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  font-size: 16px;
}
.tab {
  height: 50px;
  width: 150px;
  border-radius: 15px 15px 0px 0px;
  BACkground-color: #FFF;
  position: relative;
  top: 10px;
  left: 1px;
  display: inline-block;
  z-index: 2;
}
.tab:before {
  height: 50px;
  width: 70px;
  border-radius: 10px 10px 0px 0px;
  BACkground-color: white;
  content: "";
  position: absolute;
  left: 104px;
  top: 0px;
  -webkit-transform: skewX(40deg);
  transform: skewX(40deg);
  z-index: -1;
}
.tab:nth-of-type(2) {
  BACkground-color: #555;
  top: 10px;
  left: 30px;
  z-index: 1;
  color: #EEE;
}
.tab:nth-of-type(2):before {
  BACkground-color: #555;
}
.tab:nth-of-type(2):hover,.tab:nth-of-type(2):hover:before {
  BACkground-color: #159;
  transition: 0.3s ease-out;
}
span {
  display: inline-block;
  width: 160px;
  text-align: center;
  height: 50px;
  line-height: 50px;
  z-index: 3;
}
#page {
  BACkground-color: white;
  height: calc(100vh - 120pX);
  width: calc(100vw - 61pX);
  position: relative;
  top: 10px;
  left: 1px;
  padding: 30px;
}
<nav id="tabs">
  <div class="tab">
    <span>Tab 1</span>
  </div>
  <div class="tab">
    <span>Tab 2</span>
  </div>
</nav>
<div id="page">
  Lorem Ipsum dolor sit amet ...
</div>

大佬总结

以上是大佬教程为你收集整理的如何使用css使这样的角度选项卡?全部内容,希望文章能够帮你解决如何使用css使这样的角度选项卡?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。