A few CSS tricks that frontend developers should know

Here is a few tricks that I encountered in the process of making CSS and learned how to solve it in a simple way.

1. Vertical alignment

I offten use this in a CSS Navigation Menu.
vertical-alignment

2. Remove white space below image

3. Using display: flex, the icon is distorted when the text is long

4. Truncate Text

Solution
{
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
truncate-text

5. Disable Text Selection Highlighting

If we want to disable the highlight effect.
Solution
user-select: none;
Disable-Text-Selection-Highlighting

6. Make a Textarea Unable to Resize

7. Math with Calc

8. Change an HTML5 Input Placeholder Color

The article will still be updated with more cool things about CSS. Thank you for your support and reading until now.
My blogs hoangkhanh.tech
Thank you!

25