


How to make CSS3 adaptive full-screen focus image switching special effects
I will bring you the full-screen background switching focus image effect using pure CSS3. No JS code is included. It is simple, easy to understand and easy to use. Friends who need it can move it directly. Let’s take a look at
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>自适应全屏焦点图切换CSS3特效代码</title> <meta name="keywords" content="自适应,全屏,焦点图,切换,CSS3,特效代码" /> <meta name="description" content="自适应全屏焦点图切换CSS3特效代码,纯CSS实现不用任何js代码。" /> <style> *{margin:0;padding:0;list-style: none;} img.bg{min-width: 1024px;min-height: 100%;width: 100%;height: auto!important;height: 100%;position: fixed;top: 0;left: 0;z-index: 1;} @media screen and (max-width: 1024px) { img.bg{ left: 50%; margin-left: -512px; } } .slider{ position: absolute; width: 100%; text-align: center; z-index: 999; bottom: 100px; } .slider li{ display: inline-block; width: 170px; height: 130px; margin-right: 15px; } .slider a{ display: inline-block; width: 170px; padding-top:70px; padding-bottom:20px; position: relative; cursor: pointer; border:2px solid #fff; border-radius: 5px; vertical-align: top;/*设置元素的垂直对齐方式。*/ color: #FFFFFF; text-decoration: none; font-size: 22px; font-family: "楷体"; text-shadow: -1px -1px 1px rgba(0,0,0,0.8), -2px -2px 1px rgba(0, 0, 0, 0.3), -3px -3px 1px rgba(0, 0, 0, 0.3); } .slider li:nth-of-type(1) a{ background-color: #02646e; } .slider li:nth-of-type(2) a{ background-color: #eb0837; } .slider li:nth-of-type(3) a { background-color: #67b374; } .slider li:nth-of-type(4) a { background-color: #e6674a; } .slider li:nth-of-type(5) a { background-color: #e61061; } .slider a::after{/*:after 选择器在被选元素的内容后面插入内容。*/ content: ""; display: block; height: 120px; width: 120px; border:5px solid #fff; border-radius: 50%; position: absolute; left: 50%; margin-left: -60px; z-index: 9999; top: -80px; } .slider li:nth-of-type(1) a::after { /*:nth-of-type(n) 选择器匹配属于父元素的特定类型的第 N 个子元素的每个元素.*/ background: url(img/sbg1.jpg) no-repeat center; } .slider li:nth-of-type(2) a::after { background: url(img/sbg2.jpg) no-repeat center; } .slider li:nth-of-type(3) a::after { background: url(img/sbg3.jpg) no-repeat center; } .slider li:nth-of-type(4) a::after { background: url(img/sbg4.jpg) no-repeat center; } .slider li:nth-of-type(5) a::after { background: url(img/sbg5.jpg) no-repeat center; } .slider a::before{ content: ""; display: block; height: 120px; width: 120px; border:5px solid #fff; border-radius: 50%; position: absolute; left: 50%; margin-left: -60px; z-index: 99999; top: -80px; background:rgba(0,0,0,0.3); } .slider a:hover::before{ opacity: 0; } @-webkit-keyframes 'slideLeft'{ 0%{ left:-500px; } 100%{ left:0; } } .slideLeft:target{ /*:target 选择器可用于选取当前活动的目标元素*/ z-index: 100; animation: slideLeft 1s 1; -webkit-animation: slideLeft 1s 1; } @-webkit-keyframes 'slideBottom'{ 0%{ top:350px; } 100%{ top:0; } } .slideBottom:target{ /*:target 选择器可用于选取当前活动的目标元素*/ z-index: 100; animation: slideBottom 1s 1; -webkit-animation: slideBottom 1s 1; } @-webkit-keyframes 'zoomIn' { 0% { -webkit-transform: scale(0.1); } 100% { -webkit-transform: none; } } .zoomIn:target { z-index: 100; -webkit-animation: zoomIn 1s 1; animation: zoomIn 1s 1; } /* Zoom Out */ @-webkit-keyframes 'zoomOut' { 0% { -webkit-transform: scale(2); } 100% { -webkit-transform: none; } } .zoomOut:target { z-index: 100; -webkit-animation: zoomOut 1s 1; animation: zoomOut 1s 1; } /* Rotate */ @-webkit-keyframes 'rotate' { 0% { -webkit-transform: rotate(-360deg) scale(0.1); } 100% { -webkit-transform: none; } } .rotate:target { z-index: 100; -webkit-animation: rotate 1s 1; animation: rotate 1s 1; } @-webkit-keyframes 'notTarget' { 0% { z-index: 75; } 100% { z-index: 75; } } .bg:not(:target) { -webkit-animation: notTarget 1s 1; animation: notTarget 1s 1 } .page { text-align:left; } </style> </head> <body> <div> <ul> <li><a href="#bg1">Hipster Fashion Haircut</a></li> <li><a href="#bg2">Cloud Computing Services & Consulting</a></li> <li><a href="#bg3">My haire is sooo fantastic!</a></li> <li><a href="#bg4">Eat healthy & excersice!</a></li> <li><a href="#bg5">Lips so kissable I could die ...</a></li> </ul> </div> <img src="img/bg1.jpg" class="bg slideLeft" id="bg1" /> <img src="img/bg2.jpg" class="bg slideBottom" id="bg2" /> <img src="img/bg3.jpg" class="bg zoomIn" id="bg3" /> <img src="img/bg4.jpg" class="bg zoomOut" id="bg4" /> <img src="img/bg5.jpg" class="bg rotate" id="bg5" /> </body> </html>
There are so many special effects for adaptive full-screen focus map switching. For more exciting content, please pay attention to other related articles on the php Chinese website!
Related reading:
What new background attributes are there in CSS3
How to make a flexible box in css3
The above is the detailed content of How to make CSS3 adaptive full-screen focus image switching special effects. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-
