如何创建一个在页面顶部成角度的div标题

时间:2016-09-07 19:56:56

标签: html css header

body margin&padding = 0; 

div离开视口

<div id="banner" style="    
height: 800px;
width: 100%;
transform: rotate(165deg);
background-color: #f00;
position: absolute;
top: -400px;
left: -50px;
"></div>

1 个答案:

答案 0 :(得分:0)

将其包裹在另一个div中并设置溢出隐藏

body{margin:0}
<div style="position: relative; width: 100%; height: 300px; overflow: hidden; ">
  <div id="banner" style="    
                          height: 500px;
                          width: 200%;
                          transform: rotate(165deg);
                          background-color: #f00;
                          position: absolute;
                          top: -400px;
                          left: -100px;
                          "></div>
  </div>