页面倾斜布局效果
代码语言:html
所属分类:布局界面
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
@charset "UTF-8";
:root {
--width: 100vw;
--angle: -11deg;
/*-----------------
Magic Number Alert:
the 0.09719 is calculated by this formula:
tan(11°) / 2
11° is the current skewY value.
------------------*/
--magic-number: 0.09719;
--skew-padding: calc(var(--width) * var(--magic-number));
}
@media (min-width: 42em) {
:root {
--width: 42rem;
}
}
.diagonal-box {
position: relative;
padding: var(--skew-padding) 0;
margin-top: -1px;
}
.diagonal-box:before {
content: "";
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
transform: skewy(var(--angle));
transform-origin: 50% 0;
outline: 1px solid transparent;
backface-visibility: hidden;
}
.bg-one:before {
background-image: linear-gradient(45deg, #654ea3, #eaafc8);
}
.bg-two:before {
background-image: linear-gradient(-135deg, #ff0084, #33001b);
}
.bg-three:before {
background-image: linear-gradient(-135deg, #007, #003);
}
.content {
max-width: var(--width);
margin: 0 auto;
padding: 1.5em;
position: relative;
/* -----------
enable the border to see, that the content
perfectly fits into the section withou
bleeding into the adjecting areas:
------------ */
}
/* --------------------
Presentational Styles
-------------------- */
*, *:before, *:after {
box-sizing: border-box;
}
html {
font-size: 100%;
transition: font-size 0.2s linear;
}
@media (min-width: 70em) {
html {
font-size: 125%;
}
}
body {
background: #003;
padding-top: 8em;
color: #fff;
font-family: 'Raleway', sans-serif;
}
h1 {
text-align: center;
margin: 0 auto 1em;
padding: 0 1em;
max-width: 42rem;
line-height: 1.2;
transform: skewY(var(--angle));
font-size: 3em;
text-transform: uppercase;
font-weight: 900;
}
h2 {
font-size: 2.5em;
margin: 0 0 0.5em;
font-weight: 900;
}
.intro {
font-size: 1.25em;
transform: skewY(var(--angle));
margin: 0em auto 0em;
text-align: center;
background: #fff;
color: #003;
font-weight: 900;
padding: 0.5em;
text-transform: uppercase;
}
.intro a {
background-image: linear-gradient(transparent 90%, 0, #003 100%);
background-image: none;
border-bottom: 4px solid;
transition: none;
}
.intro a:hover {
border-color: #a06;
opacity: 1;
}
p {
font-size: 1.25em;
margin: 0;
line-height: 1.5;
}
p + p, svg + p {
margin-top: 1em;
}
p code {
background: #0033;
padding: 0.125em 0.375em;
border-radius: 0.125em;
}
@media (min-wid.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0