DEV Community

Rin
Rin

Posted on

Do you Know how to { content: attr({data-attribute}); } ?

We can pass the deta  to el::before,after{ content:'';}

    <div class="button">
        <span data-attribute="HOME">HOME</span>
    </div>
    .button{
        span::before {
            content: attr(data-attribute);
            }
        }
    }

It's bery easy!!!

I created a simple animation using this mechanism.

Thanks!!!!

See the Pen content data-attribute by Rin_T_T (@Rin_T_T) on CodePen.

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay