Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>HTML slider onclick (no frameworks) (no javascript) pure CSS</title>
- <style>
- a {
- display: block;
- font-size: 20px;
- font-family: verdana;
- width: 150px;
- border: none;
- outline: none;
- color: white;
- background-color: red;
- text-decoration: none;
- text-align: center;
- padding: 5px 10px;
- position: absolute;
- z-index: 1;
- top: 10px;
- right: 10px;
- }
- .stop {
- display: block;
- font-size: 20px;
- font-family: verdana;
- width: 150px;
- border: none;
- outline: none;
- color: white;
- background-color: red;
- text-decoration: none;
- text-align: center;
- padding: 5px 10px;
- position: absolute;
- z-index: 1;
- top: 100px;
- right: 10px;
- }
- slider_container {
- margin: auto;
- position: relative;
- width: 700px;
- height: 400px;
- border: 5px solid red;
- display: block;
- overflow-x: hidden;
- overflow-y: hidden;
- box-sizing: border-box;
- }
- slider {
- position: absolute;
- width: 3500px;
- top: 0;
- left: 0;
- }
- img {
- width: 700px;
- height: 400px;
- float: left;
- }
- #slider:target {
- animation: move 10s linear infinite;
- }
- .clone{
- position:absolute;
- top:10px;
- left:10px;
- text-decoration: none;
- background-color: red;
- width: 150px;
- text-align: center;
- color: snow;
- font-family: arial black;
- padding: 5px 20px;
- }
- @keyframes move {
- 0% {
- margin-left: -700px;
- }
- 14% {
- margin-left: -700px;
- }
- 24% {
- margin-left: -700px;
- }
- 38% {
- margin-left: -1400px;
- }
- 48% {
- margin-left: -1400px;
- }
- 62% {
- margin-left: -2100px;
- }
- 72% {
- margin-left: -2100px;
- }
- 86% {
- margin-left: -2800px;
- }
- 100% {
- margin-left: -2800px;
- }
- }
- </style>
- </head>
- <body>
- <a href='#slider' class='start'>Start Slider Animation</a>
- <a href='#' class='stop'>Stop Slider Animation</a>
- <slider_container>
- <slider id='slider'>
- <img src='https://1xpto.netlify.app/pics/1.jpg'>
- <img src='https://1xpto.netlify.app/pics/1.jpg'>
- <img src='https://1xpto.netlify.app/pics/3.jpg'>
- <img src='https://1xpto.netlify.app/pics/4.jpg'>
- <img src='https://1xpto.netlify.app/pics/7.jpg'>
- </slider>
- </slider_container>
- <a class='clone' href='https://www.youtube.com/channel/UCqLpDK0eOsG1eEeF9jOUZkw'>SUBSCRIBE</a>
- <script></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement