Useful CSS Tricks

Useful CSS Tricks


Text Selection Color

To give text selection color use selection pseudo element on your website.

By default while select text on browser it's showing blue background with white text color. Now we change background color as black and apply text color as white.

text selection css


CSS CODE


selection selector



Truncate Text

The line-clamp property truncates text at a specific number of lines.

truncate-text


line-clamp truncate text

Smooth Scrolling

Enable smooth scrolling throughout the HTML page.

smooth scroll in html

Disable User Selection

To prevent select some element on webpage used user-select:none .

disable user selection in browser


Vertical Text

Write vertical text bottom to top using two css properties. 


vertical-text


How to set vertical text using css



-webkit-text-stroke

This property can be used to assign an outline to the text.

color: transparent;
-webkit-text-stroke: 1px #04D939;



Previous Post Next Post