CSS效果:焦点图片
HTML:
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="style.css"> <link href="https://fonts.font.im/css?family=Indie+Flower" rel="stylesheet"> <title>Document</title> </head> <body> <section class="split"> <div class="screen"> <div class="content"> <h2>西江月·世事一场大梦</h2> <h4>宋代:苏轼</h4> <p>世事一场大梦,人生几度秋凉?<br>夜来风叶已鸣廊。<br>看取眉头鬓上。<br> 酒贱常愁客少,月明多被云妨。<br>中秋谁与共孤光。<br>把盏凄然北望。 </p> </div> </div> <div class="screen"> <div class="content"> <h2>蝶恋花·庭院深深深几许</h2> <h4>宋代:欧阳修</h4> <p>庭院深深深几许,杨柳堆烟,帘幕无重数。<br>玉勒雕鞍游冶处,楼高不见章台路。<br> 雨横风狂三月暮,门掩黄昏,无计留春住。<br>泪眼问花花不语,乱红飞过秋千去。 </p> </div> </div> <div class="screen"> <div class="content"> <h2>浪淘沙令·帘外雨潺潺</h2> <h4>五代:李煜</h4> <p>帘外雨潺潺,春意阑珊,罗衾不耐五更寒。<br>梦里不知身是客,一晌贪欢。<br> 独自莫凭栏,无限江山,别时容易见时难。<br>流水落花春去也,天上人间。 </p> </div> </div> </section> </body> </html>
CSS:
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。body{ margin:0; padding:0; font-family: 'Indie Flower', cursive; } section{ position: relative; height:100vh; display: flex; background:#000; } section .screen{ position: relative; flex-grow: 2; display: flex; overflow: hidden; transition: 0.5s; opacity: .3; } section:hover .screen{ opacity: .3; } section .screen:hover{ flex-grow: 4; opacity: 1; } section .screen:nth-child(1){ background: url(./img/1.jpg); background-repeat: no-repeat; background-position: center; background-size:cover; } section .screen:nth-child(2){ background: url(./img/2.jpg); background-repeat: no-repeat; background-position: center; background-size:cover; } section .screen:nth-child(3){ background: url(./img/3.jpg); background-repeat: no-repeat; background-position: center; background-size:cover; } section .screen .content{ position: absolute; bottom:0; right:0; width:400px; height:auto; background:#fff; padding:40px; box-sizing: border-box; transform: translateX(100%); transition: 0.5s; text-align:justify; } section .screen:hover .content{ transform: translateX(0); transition-delay: 0.5s; } section .screen .content h2{ font-size:25px; color:#3c6382; } section .screen .content h4{ font-size:20px; color:#3c6382; } section .screen .content p{ color:#60a3bc; }
效果图:

更多精彩