我试图在我的网页的标题上得到一个用css绘制的形状。它应该看起来像这样。 The shape am trying to draw for my header用css绘制形状
,但是当我试图得到确切的形状,它看起来像下面这样(运行段)
我不是在CSS那么好,所以我在这里挣扎。代码如下。
header {
padding: 0px !important;
height: auto !important;
}
.header {
top: 0px;
width: 100%;
height: auto !important;
padding: 0px !important;
background-color: #00ff00;
}
.spanheader {
font-size: 20px;
}
.logo {
z-index: 1;
position: relative;
}
.topheader {
text-align: center;
width: 100%;
background-color: lightgray;
left: 0px !important;
top: 0px !important;
}
#draw {
height: 30px;
width: 100%;
background-color: #fff;
}
#green {
height: 60px;
width: 100%;
border-width: 0px;
border-left: 280px solid white;
border-top: 20px solid white;
-moz-transform: skew(-45deg);
-webkit-transform: skew(-45deg);
transform: skew(-45deg);
}
<section id="header" class="header">
<div class="topheader">
<span class="spanheader f-700 c-gray">HEADER</span>
</div>
<div id="draw"></div>
<div id="green"></div>
</section>
什么想实现我的头和形状绘制
final look I want to achieve or what it should should look like at the end
兰迪如果我想的图像等元素添加了'div'里面'draw class'和我d不想让该元素偏斜,我该如何将绘图应用于背景,然后像菜单这样的元素现在可以放置在其中。 –
您可以使'.green'元素的位置:relative和' .draw'元素'位置:绝对'。这样,如果向'.green'元素添加更多元素,它将完全忽略倾斜的'.draw'元素。 – Randy
虽然没有工作。再看看我的问题。我添加了一张关于我的最终结果是什么样子的图片。谢谢你的帮助。我很感激 –