Is it possible to create a sheared div?

*爱你&永不变心* 提交于 2019-12-09 03:58:54

问题


Is it possible to create a header div that is sheared/oblique like in the image below?

Its for a mobile website


回答1:


Yes, this is possible: 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>


来源:https://stackoverflow.com/questions/28211471/is-it-possible-to-create-a-sheared-div

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!