原文地址:https://segmentfault.com/a/1190000014751037

HTML代码:

<div class="books">
<div class="book html">
<span>HTML</span>
</div>
<div class="book css">
<span>CSS</span>
</div>
<div class="book js">
<span>JavaScript</span>
</div>
</div>

CSS代码:

html, body {
margin:;
padding:;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(to top left,white,dimgray);
}
/* 3本书布局 */
.books{
display: flex;
width: calc(12rem * 3 + 3rem * 2);
justify-content: space-between;
margin-top: 6rem;
}
.book:nth-child(2){
top: -3rem;
}
.book:nth-child(3){
top: -6rem;
}
/* 画出书的正面 */
.book{
position: relative;
width: 12rem;
height: 18rem;
transform: skewY(-10deg);
background: linear-gradient(navy, deeppink, tomato);
/* 给图书加阴影,让它显得更立体 */
box-shadow: -10px 5px 30px rgba(0,0,0,0.5);
transition: 0.3s;
}
/* 画出书的侧面 */
.book::before{
content: '';
position: absolute;
width: 1.5rem;
height: 100%;
background: linear-gradient(navy, deeppink, tomato);
top:;
left: -1.5rem;
transform: skewY(45deg);
transform-origin: right;
filter: brightness(0.6);
}
/* 画出书的顶面 */
.book::after{
content: '';
position: absolute;
width: 100%;
height: 1.5rem;
background: white;
top: -1.5rem;
left:;
transform-origin: bottom;
transform: skewX(45deg);
filter: brightness(0.9);
}
/* 设置文字样式 */
.book span{
position: absolute;
font-size: 2.2rem;
font-family: sans-serif;
width: 100%;
height: 8rem;
display: block;
text-align: center;
margin-top: 5rem;
padding-top: 2rem;
box-sizing: border-box;
text-shadow: -2px 2px 10px rgba(0,0,0,0.3);
background: silver;
}
/* 画出文字侧面,与画图书侧面的方法相似 */
.book span::before{
content: '';
position: absolute;
width: 1.5rem;
height: 100%;
background: silver;
top:;
left: -1.5rem;
transform-origin: right;
transform: skewY(45deg);
filter: brightness(0.6);
}
/* 文字下增加一行小字号文字 */
.book span::after{
display: block;
font-size: 1rem;
}
/* 3本书配色 */
.book.html span,
.book.html span::before {
background: orange;
}
.book.css span,
.book.css span::before {
background: yellowgreen;
}
.book.js span,
.book.js span::before {
background: royalblue;
}
/* 设置 3 本书的小字号文字 */
.book.html span:after {
content: '<devolopment />';
}
.book.css span::after {
content: '.devolopment::';
}
.book.js span::after {
content: '{ devolopment }';
}
/* 为图书增加鼠标划过效果 */
.book:hover {
margin-top: -1.5rem;
}

最新文章

  1. 3.View绘制分析笔记之onLayout
  2. (转)浅析Java中的访问权限控制
  3. windows搭建openacs编译环境
  4. DirectDraw打造极速图形引擎(Alpha混合)
  5. HDU 5033 Building(单调栈维护凸包)
  6. python 加密模块安装
  7. zabbix中文配置及乱码问题
  8. 推荐两个不错的CAD二次开发(.Net)手册
  9. react.js 从零开始(六)Reconciliation
  10. ubuntu 自动获取ip的怎么设置
  11. 使用HAL库函数建立STM32F2工程
  12. Javascript 基础知识2017-03-17
  13. [Swift]LeetCode492. 构造矩形 | Construct the Rectangle
  14. LV 指定或修改逻辑卷的major, minor号[RHEL6]
  15. 2018年年度总结 &amp; 2019年计划
  16. @NotNull和@NotEmpty和@NotBlank 区别
  17. BOM 清除
  18. 洛谷.U19464.山村游行wander(LCT 伪期望)
  19. 吴裕雄 python神经网络(6)
  20. Dos常用命令大全

热门文章

  1. zabbix 3.4监控mysql,提示mysql: [Warning] Using a password on the command line interface can be insecure.
  2. 微信JS API PHP类
  3. xfce的主题
  4. CenOS下搭建PPTP服务
  5. [转][C#]WebAPI 必需 Dll
  6. Hadoop+Hbas完全分布式安装部署
  7. 制作OpenStack云平台centos6.5镜像
  8. dialog--not attached to window manager
  9. intent--Activity之间数据传递之Intent数据传递
  10. Redis 主从+哨兵+监控 (centos7.2 + redis 3.2.9 )