web299.com
全部
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
首页
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
当前位置:
首页
>
网页特效
>
背景
html5和css3制作不规则的网页背景分割线
分类:
背景
日期:
2024-05-14
点击(0)
评论(0)
演 示
免费下载
简介
##### html结构: 实用一个section来包裹所有的内容,其中放置一个class为se-slope的div,div中放置的是文章article。 ```html
Some headline
Some text
``` ##### CSS 背景的颜色和偶数se-slope单元的背景色一致。 ```html body{ background: #e90089; } ``` 包裹容器设置为overflow:hidden,因为当我们旋转某些元素的时候,它们可能会发生溢出。: ```html .se-container{ display: block; width: 100%; overflow: hidden; padding-top: 150px; } ``` 所有的div都将被旋转:单数的div将填充黑色和旋转5度,偶数的div将填充紫色并旋转-5度。在旋转时我们需要调整单数div的位置,这里是在顶部添加了一个margin。 ```html .se-slope{ margin: 0 -50px; transform-origin: left center; } .se-slope:nth-child(odd){ background: #000; transform: rotate(5deg); margin-top: -200px; box-shadow: 0px -1px 3px rgba(0,0,0,0.4); } .se-slope:nth-child(even){ background: #e90089; transform: rotate(-5deg); box-shadow: 0px 2px 3px rgba(0,0,0,0.4) inset; } ``` 文章居中显示: ```html .se-content{ margin: 0 auto; } ``` 给标题添加一些好看的样式。这里使用了 :before和 :after伪元素来在标题的两端添加三角形效果。 这时候该隐藏radio按钮: ```html .se-content h3{ font-size: 60px; position: relative; display: inline-block; padding: 10px 30px 8px 30px; height: 80px; line-height: 80px; margin-bottom: 20px; font-family: 'Bitter', 'Trebuchet MS', Arial; text-shadow: 1px 1px 1px rgba(0,0,0,0.9); } .se-slope:nth-child(odd) .se-content h3{ background: #e90089; color: #000; } .se-slope:nth-child(even) .se-content h3{ background: #000; color: #e90089; } .se-content h3:before{ content: ''; width: 0; height: 0; border-top: 38px solid transparent; border-bottom: 60px solid transparent; border-right: 60px solid black; position: absolute; left: -59px; top: 0px; } .se-content h3:after{ content: ''; width: 0; height: 0; border-top: 38px solid transparent; border-bottom: 60px solid transparent; border-left: 60px solid black; position: absolute; right: -59px; top: 0px; } ``` 调整一些单数单元的元素的颜色: ```html .se-content p{ width: 75%; max-width: 500px; margin: 0 auto; font-style: italic; font-size: 18px; line-height: 24px; padding-top: 10px; } ``` 使用:first-letter选择器将第一个字母美化一下: ```html .se-content p:first-letter{ font-size: 40px; font-family: 'Adobe Garamond Pro', Georgia, serif; } ``` 最后将文章部分旋转回0度,并调整padding使它更好看些: ```html .se-slope:nth-child(odd) .se-content{ transform: rotate(-5deg); color: #e90089; padding: 130px 100px 250px 100px; } .se-slope:nth-child(even) .se-content{ transform: rotate(5deg); color: #000; padding: 150px 100px 250px 100px; } ```
相关推荐
html5浪漫粒子表白文字特效
SlidesJS幻灯片特效
html5瀑布流相册特效
css3 svg实现的情人节表白鲜花动画特效
t-scroll.js基于ES6的DOM元素,过渡动画库插件
纯js写省市区三级联动效果
广告
广告