好吧,所以当在倾斜的元素上使用背景图像时,似乎会造成间隙,我不知道为什么。当项目没有倾斜时,就没有间隙。原因是什么?我该如何解决这个问题?
您可以在以下网址上看到该问题
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;
}
倾斜版本:
正常版本: