html 文章内容滑动效果,HTML5水平滑动切换的文章内容面板

CSS

语言:

CSSSCSS

确定

:root {

--dark: #454549;

--light: #fff;

--mist: #eee;

--shadow: rgba(0, 0, 0, 0.4);

--accent: #0dc7db;

--line: .15ch;

--line-color: var(--dark);

}

.content {

-webkit-box-flex: 0;

-webkit-flex: 0 0 100%;

-ms-flex: 0 0 100%;

flex: 0 0 100%;

padding: 1em;

overflow: auto;

will-change: transform;

-webkit-transform: translateX(0%);

transform: translateX(0%);

-webkit-transition: -webkit-transform .3s ease-out;

transition: -webkit-transform .3s ease-out;

transition: transform .3s ease-out;

transition: transform .3s ease-out, -webkit-transform .3s ease-out;

}

[step="2"] .content {

-webkit-transform: translateX(-100%);

transform: translateX(-100%);

}

[step="3"] .content {

-webkit-transform: translateX(-200%);

transform: translateX(-200%);

}

[step="4"] .content {

-webkit-transform: translateX(-300%);

transform: translateX(-300%);

}

article {

display: -webkit-box;

display: -webkit-flex;

display: -ms-flexbox;

display: flex;

-webkit-box-orient: vertical;

-webkit-box-direction: normal;

-webkit-flex-direction: column;

-ms-flex-direction: column;

flex-direction: column;

}

section {

-webkit-box-flex: 1;

-webkit-flex: 1;

-ms-flex: 1;

flex: 1;

display: -webkit-box;

display: -webkit-flex;

display: -ms-flexbox;

display: flex;

position: relative;

overflow: hidden;

}

main {

-webkit-box-flex: 1;

-webkit-flex: 1;

-ms-flex: 1;

flex: 1;

display: -webkit-box;

display: -webkit-flex;

display: -ms-flexbox;

display: flex;

-webkit-flex-flow: column;

-ms-flex-flow: column;

flex-flow: column;

-webkit-box-align: center;

-webkit-align-items: center;

-ms-flex-align: center;

align-items: center;

-webkit-box-pack: center;

-webkit-justify-content: center;

-ms-flex-pack: center;

justify-content: center;

}

article {

width: 50vw;

height: 50vh;

min-width: 20em;

min-height: 15em;

border: var(--line) solid var(--line-color);

border-radius: .3em;

overflow: hidden;

background: var(--light);

box-shadow: 0 1em 3em -1em var(--shadow);

}

header {

padding: 1em;

border-bottom: var(--line) solid var(--line-color);

background: var(--accent);

color: var(--light);

}

footer {

-webkit-box-flex: 0;

-webkit-flex: none;

-ms-flex: none;

flex: none;

border-top: var(--line) solid var(--line-color);

text-align: right;

display: -webkit-box;

display: -webkit-flex;

display: -ms-flexbox;

display: flex;

-webkit-box-pack: justify;

-webkit-justify-content: space-between;

-ms-flex-pack: justify;

justify-content: space-between;

background: var(--mist);

}

footer button {

border-radius: 0;

}

button {

font-size: inherit;

font-family: inherit;

border: none;

border-radius: .2em;

padding: .65em 1.3em;

background: var(--dark);

color: var(--light);

opacity: 1;

outline: none;

cursor: pointer;

}

button[disabled] {

opacity: .3;

cursor: not-allowed;

}

button[disabled].cancel {

color: inherit;

}

button.primary:not([disabled]) {

background: var(--accent);

}

button.cancel {

background: transparent;

color: var(--accent);

}

*,

*::before,

*::after {

box-sizing: border-box;

}

html,

body {

height: 100%;

}

html {

font-size: 10px;

}

body {

margin: 0;

display: -webkit-box;

display: -webkit-flex;

display: -ms-flexbox;

display: flex;

font-family: Helvetica, Arial, sans-serif;

font-size: calc(1em + 1vmin);

color: var(--dark);

background: var(--light);

}

a {

color: var(--accent);

text-decoration: none;

}

h3 {

font-weight: 200;

opacity: .7;

}

h3,

h4,

p {

margin: 0;

}

h3 + *,

h4 + *,

p + * {

margin-top: 1em;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值