html - 是否可以创建一个剪切的 div?

标签 html css css-shapes divider

是否可以创建如下图所示的剪切/倾斜的标题 div?

它用于移动网站

enter image description here

最佳答案

是的,这是可能的:DEMO

   .wrapper {
overflow:hidden;
height:300px;
width:100%;
background: url(http://placekitten.com/g/300/300);
position:relative;
}
.top {
background:gray;
height:60%;
width:130%;
position:absolute;
top:-30%;
left:-5%;
transform:rotate(5deg);
border-bottom:10px solid white;
}
.text{
position:absolute;
top:20px;
right:10%;
padding:10px;
border-radius:10px;
border:5px solid white;
transition:all 0.8s;
}
.text:hover{
box-shadow:0 0 10px white;
}
<div class="wrapper">
    <div class="top"></div>
    <div class="text">MENU</div>
</div>

关于html - 是否可以创建一个剪切的 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28211471/

相关文章:

html - 最后一个 div 填充剩余高度

html - CSS:字体大小不准确吗?

javascript - jQuery 插件自动附加到 li 元素?

html - 创建对 Angular 线背景图像

css - 如何在CSS中制作半方形背景

html - Angular 7 组件 : how to detect a change by user interaction?

javascript - 下载 IE9 的 base64 编码图像

html - Bootstrap - 在较小的 View 中将右列向左移动

CSS:DIV 中的 SVG 放置

css - 形状外和垂直对齐的文本