页面倾斜布局效果

代码语言: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 {
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0