Do you still use float? Here is a nice use case
The CSS float
property has mostly become obsolete, thanks to flexbox and grid. But it still has a few use cases. It's not the best option for layouts anymore, but little things can still use float
.
One of the use cases is to highlight the first letter of a paragraph, giving the newspaper effect like this.
For better context, without float
, this is what we would have. You can clearly see the difference.
Here's the code for styling the first letter and making it fit next to the rest of the text.
Here's the demo
Neat, isn't it?
Do you still use float
for something like this? Let me know, I'd like to learn some more use cases.
📘 Complete Guide to CSS Flex and Grid
If you loved this write-up and how it was explained, you’ll absolutely love my eBook CSS Flex and Grid. Check it out!
📨 Newsletter suggestion
I love Tailwind CSS. If you love it too, I highly recommend subscribing to this one 👇
Tailwind Weekly: Weekly newsletter about all things Tailwind CSS. New issue every Saturday.