5 CSS tricks that you should know

5 CSS tricks that you should know

In this article you will learn five unique and useful CSS tricks.

.inactive-link{
  pointer-events : none;
  cursor : default;
}

You can disable any link by using the CSS code above.

2. Disable text selection.

.prevent-select{
user-select : none;
}

Setting user-select CSS property to none disables text selection.

3.Making an image fit.

img{ 
height : 100%;
width : 100%;
object-fit : contain;
}

The object-fit property defines how the image or video should be resized to fit it's container

4. Resize image to fit.

img{
max-width : 100%;
height : auto;
}

This CSS code is used to ensure that an image is displayed at its maximum width without distorting its aspect ratio.

Disable Textarea resize.

textarea{
resize : none;
}

This CSS code is used to disable the ability of a user to resize a textarea element. This is useful in cases where you want to limit the amount of text a user can input into a specific field, or if you want to ensure that the layout of the page remains consistent.

Thank You.