使用偏斜的背景图像造成间隙?

时间:2020-03-15 12:20:19

标签: html css

好吧,所以当在倾斜的元素上使用背景图像时,似乎正在引起间隙,我不确定为什么。当项目不倾斜时,没有间隙。是什么原因造成的?如何解决该问题?

您可以在this CodePen上看到此问题。

HTML

<ul id="menu-main-menu" class="navbar-nav">
  <li id="menu-item-143" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-143 nav-item"><a href="#about" class="nav-link">About</a></li>
  <li id="menu-item-144" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-144 nav-item"><a href="#gameplay" class="nav-link">Gameplay</a></li>
  <li id="menu-item-145" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-145 nav-item"><a href="#crowd" class="nav-link">Crowd Funding</a></li>
  <li id="menu-item-146" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-146 nav-item"><a href="#mail" class="nav-link">Mail</a></li>
  <li id="menu-item-147" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-147 nav-item"><a href="#contact" class="nav-link">Contact</a></li>
  <li id="menu-item-148" class="menu-download menu-item menu-item-type-custom menu-item-object-custom menu-item-148 nav-item"><a target="_blank" href="#!" class="nav-link">Download</a></li>
</ul>

CSS

body {
  background: #000;
}

a {
  color: #FFF;
  margin: 0 20px;
  text-decoration: none;
}

.navbar-nav > li {
    padding: 0;
    background: url(https://indie.nathandasilva.co.uk/wp-content/themes/indie/assets/img/menu-bg.png);
    background-size: 1px 63px;
    height: 63px;
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: skew(0);
}

.navbar-nav {
    padding: 16px 0px 16px 21px !important;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-nav > li a {
    transform: skew(0deg);
    font-family: 'BebasNeue-Regular', sans-serif !important;
    font-size: 26px !important;
}

倾斜版本:

Skewed

普通版:

enter image description here

0 个答案:

没有答案