Before::& After:: (The Power Divolution by CSS)
Credits: Milap Patel Linked In

Before::& After:: (The Power Divolution by CSS)

Entering the world of frontend development, newbies often find it surprising that Bootstrap and Tailwind CSS offer built-in classes. They might argue that since it's easy to use these pre-built classes, there's no need to complicate things by working directly with colors and gradients in standard CSS.

This argument makes sense, but it's important to remember that "Smartness is scary if you aren't smart enough to exhibit it." While relying on built-in functions or classes can be efficient, understanding the underlying logic is crucial. Just as we learn to create our own functions in programming to apply logic in various scenarios, mastering CSS can elevate your skills.

CSS (Cascading Style Sheets) turns you into an "unofficial designer" (with all due respect to UI/UX designers ??) by challenging your aesthetic sense, color choice, typography, spacing, and responsiveness. By honing these skills, you can create visually appealing and functional designs that stand out.

Mastering CSS gives you the creative freedom to bring your vision to life without being constrained by the limitations of pre-built classes. It allows you to tailor your designs to specific needs and ensures that you have the flexibility to innovate in ways that pre-built solutions might not offer.

Let's dive into an amazing Power Divolution feature in CSS, Before:: and After :: Elements which are called Psuedo Elements if take it precisely. These pseudo-elements allow you to insert content dynamically without altering your HTML structure. The ::before pseudo-element is used when you want to insert new content before your existing text content, while the ::after pseudo-element helps you add content right after your text content. For example:


Credits: Coding2Go

While the example above demonstrates a basic use of ::before and ::after pseudo-elements, their capabilities go far beyond simple content insertion. In fact, these pseudo-elements can tackle challenges that might be difficult to solve with regular CSS.

Take, for example, the task of applying a gradient to a border—something that's not straightforward with standard CSS. However, with the help of ::before and ::after, you can create the desired effect.

Another great use case is customizing bullets in an unordered list. If you find the default bullets unappealing, you can use these pseudo-elements to design custom bullets that match your aesthetic preferences. This is where the true power of these elements shines—what I like to call "Power Divolution." It gives developers the maximum ability to tailor their web pages to their exact specifications.


Credits: Coding2Go

One of the best examples of CSS's power in action is the hover effects applied to buttons or links. Thanks to CSS, we have the privilege of enhancing our web pages with stunning hover effects, and the ::before and ::after pseudo-elements play a key role in achieving these effects. Check out this example:


Credits: Lambda Test

In conclusion, CSS offers a wide array of tools that empower developers to craft visually appealing and highly customizable web pages. While frameworks like Bootstrap and Tailwind CSS provide convenient, ready-made solutions, understanding and mastering the underlying CSS techniques, such as ::before and ::after pseudo-elements, can significantly elevate your design capabilities. So, keep exploring and learning to ace in the journey of Web development.

Muhammad Raza Ali

Co-Lead MLSA PUCIT | β-MLSA @Microsoft |Amal Alumni '24 | ALP'24 | Mentor @ GSSOC'24 | Machine Learning Enthusiastic || I don't believe in the good,better or best one,I like the perfectionist...

6 个月

Keep up the good work brooooo....??

Unsa Saleem

Pursuing Software Engineering at PUCIT | UI/UX Designer

6 个月

Insightful????

要查看或添加评论,请登录

M. Shahmeer Zaidi的更多文章

  • Three Dots of JS (Spread vs Rest Operator {...})

    Three Dots of JS (Spread vs Rest Operator {...})

    Every programming language comes with its own distinct and comprehensive library for implementing various features. For…

  • Event Bubbling & Event Delegation in JS

    Event Bubbling & Event Delegation in JS

    In JavaScript, events in the DOM have a default behavior known as "event bubbling." This concept is analogous to water…

    1 条评论

社区洞察

其他会员也浏览了