How To Create a Website With Sliding Text Using Only CSS3

Published by codingmaster on

Hello Friends, today in this blog you’ll learn how to create a website with sliding text effect using only css3.

Creating a website with sliding text effect is a amazing practice to level up your skills in web design also this effect makes a website more attractive , so the user impressed from your website and it’s very simple also a beginner can make a website with sliding text.

Video Tutorial of How to make website with sliding text Using Only HTML & CSS

In the video, first we’ve create a simple navigation menu bar and styling with css after this we add some text on the web page and give some styling using css also add a button with animation effect. for sliding text we simply add some text using “<span>” tag & using css animation properties convert it into a sliding text animation. So it’s very simple tutorial. After watching this tutorial you guys can easily create this type of amazing websites.

So, enjoy the tutorial & learn something new today 🙂

Website Using Sliding Text [ SOURCE CODE ]

First, create an HTML file with the name of index.html and paste the given codes in your HTML file. Remember, you’ve to create a file with .html extension.

<!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">
    <link rel="stylesheet" href="style.css">
    <title>Create a Website With Sliding Text</title>
</head>
<body>
    <div class="container">
        <div class="navbar">
            <img src="images/logo.png" class="logo">
            <h3>Coding Club</h3>
            <nav>
                <ul>
                    <li><a href="">Home</a></li>
                    <li><a href="">About</a></li>
                    <li><a href="">Blog</a></li>
                    <li><a href="">Community</a></li>
                    <li><a href="">Contact Us</a></li>
                </ul>
            </nav>
        </div>
        <div class="content">
            <div class="text">
                Become a
                <div class="slider">
                    <div>Programmer</div>
                    <div>Web Developer</div>
                    <div>App Developer</div>
                </div>
            </div>
            <p>We're providing free content on our platform for future programmers.<br> If you want to become a good programmer then Join our community now & level up your skills with us
            </p>
            <button class="btn">Register Now</button>
        </div>
    </div>
</body>
</html>

Second, create a CSS file with the name of style.css and paste the given codes in your CSS file. Remember, you’ve to create a file with .css extension.

* {
     margin: 0;
     padding: 0;
     font-family: 'Poppins', sans-serif;
 }
 .container {
     height: 100vh;
     width: 100%;
     background-image: linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.85)), url(images/bg.jpg);
     background-position: center;
     background-size: cover;
     position: relative;
     box-sizing: border-box;
     padding-right: 5%;
     padding-left: 3%;
 }
 .navbar {
     width: 100%;
     height: 15vh;
     margin: auto;
     display: flex;
     align-items: center;
 }
 .logo {
     width: 70px;
     margin-top: 10px;
     cursor: pointer;
 }
 h3 {
     color: #fff;
     text-transform: uppercase;
     font-weight: 700;
     font-size: 20px;
     margin-top: 10px;
 }
 nav {
     flex: 1;
     padding-left: 480px;
 }
 nav ul li {
     display: inline-block;
     list-style: none;
     margin: 0 15px;
 }
 nav ul li a {
     text-decoration: none;
     color: #fff;
     font-size: 15px;
     font-weight: 600;
     text-transform: uppercase;
 }
 nav ul li a:hover {
     color: #ffbd59;
 }
 .content {
     width: 100%;
     position: relative;
     top: 45%;
     transform: translateY(-50%);
     text-align: center;
     color: #fff;
 }
 .text {
     font-size: 70px;
     font-weight: 700;
     text-transform: uppercase;
     height: 100px;
     display: flex;
     text-align: left;
     overflow: hidden;
     justify-content: center;
     align-items: center;
 }
 p {
     font-size: 15px;
     font-weight: 500;
     line-height: 20px;
     letter-spacing: .1em;
     margin-top: 40px;
 }
 .btn {
     background: linear-gradient(to right, transparent 50%, #ffbd59 50%);
     background-size: 200% auto;
     background-position: left;
     margin-top: 70px;
     margin-left: 50px;
     padding: 15px 45px;
     text-align: center;
     border: 2px solid #ffbd59;
     outline: none;
     color: #fff;
     font-weight: 700;
     text-transform: uppercase;
     font-size: 24px;
     border-radius: 30px;
     cursor: pointer;
     box-shadow: 3px 8px 22px rgba(22,21,21,.15);
     transition: background-position .5s;
 }
 .btn:hover {
     background-position: right;
     color: #1b1b1b;
 }
 .slider {
     color: #ffbd59;
     margin-left: 14px;
     box-sizing: border-box;
     animation: slider 6s linear infinite;
 }
 @keyframes slider {
     0% {
         margin-top: -320px;
     }
     5% {
        margin-top: -160px;
    }
    30% {
        margin-top: -160px;
    }
    35% {
        margin-top: 0px;
    }
    65% {
        margin-top: 0px;
    }
    70% {
        margin-top: 160px;
    }
    100% {
        margin-top: 160px;
    }
}
Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *