Creating Cards / Containers

HTML

html
KopiérRediger
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Animated Border Boxes</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>

    <div class="container">
        <div class="card">
            <h2>Animate Borders</h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Atque ad exercitationem voluptatem ullam et.</p>
        </div>
        <div class="card">
            <h2>Animate Borders</h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Atque ad exercitationem voluptatem ullam et.</p>
        </div>
        <div class="card">
            <h2>Animate Borders</h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Atque ad exercitationem voluptatem ullam et.</p>
        </div>
    </div>

</body>
</html>


CSS (styles.css)

css
KopiérRediger
body {
    font-family: Arial, sans-serif;
    background-color: #0D0D0D;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.container {
    display: flex;
    gap: 20px;
}

.card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    width: 250px;
    text-align: center;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    transition: 0.3s ease-in-out;
}

.card h2 {
    font-size: 20px;
    color: #fff;
}

.card p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.card::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    border-radius: 12px;
    background: linear-gradient(45deg, #ff4e50, #fc913a, #f9d423, #e1eec3, #ff4e50);
    background-size: 300%;
    z-index: -1;
    animation: borderAnimation 4s infinite linear;
}

@keyframes borderAnimation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


Explanation:

This will give you three stylish, animated text boxes on your website! 🎨🚀 Let me know if you need any modifications! 😊