Before::& After:: (The Power Divolution by CSS)
M. Shahmeer Zaidi
PUCIT '26 | Software Engineer | Amal Fellow | ML | Web Developer | JavaScript | React JS | Bootstrap | Python | C | CPP| C# .Net | Java | MySQL | Teaching Assistant for DSA and Algorithm Analysis @PUCIT
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:
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.
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:
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.
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....??
Pursuing Software Engineering at PUCIT | UI/UX Designer
6 个月Insightful????