Do you have images on your webpage / website? You probably have.
Here are 5 cool things related to images on webpage, that I think you are not familiar with
π§΅ππ»
1οΈβ£ Set image scaling algorithm of user agent
The `image-rendering` CSS property sets an image scaling algorithm
When you specifies dimensions of image other than its natural size then the image will be up/downscaled by user agent using the algorithm specified by image-rendering
For example: "crisp-edges"
The image must be scaled with an algorithm that preserves contrast and edges in the image, and which does not smooth colors or introduce blur to the image in the process.
Check the output image carefully
You can pass five other values in "image-rendering" property, there are
- auto
- smooth
- high-quality
- crisp-edges
- pixelated
2οΈβ£ Tell how the browser should load the image
The "loading" attribute. Although its still in experiment but its a good thing to know.
It accepts two values, `eager` and `lazy`..... β¬
eager: Loads the image immediately, regardless of whether or not the image is currently within the visible viewport.
lazy: Defers loading the image until it reaches a calculated distance from the viewport, as defined by the browser.
3οΈβ£ Shadow in non background images
The box-shadow property creates a rectangular shadow behind an element's entire box, while the drop-shadow() filter function creates a shadow that conforms to the shape (alpha channel) of the image itself.
4οΈβ£ Edit images using filter functions
The filter CSS property applies graphical effects like blur or color shift to an element. Filters are commonly used to adjust the rendering of images, backgrounds, and borders.
Using filter funtions you can apply blur, adjust brightness, change contrast, hue roatate and other amazing stuff. Definitely try it out
Creating CSS arts is a good way to master CSS. Here are some resources and tips that will take your CSS skills to the next level π
π§΅ππ»
Trust me, CSS art looks hard but they are not so tough they seem.
First things first, good color contrast is the number characterstic of a good website. Similarly color combinations makes your art good.
People with visual impairment preceive colors in different way. For example, here is how the dark red color is seen by people with monochromacy, dichromacy, and trichromacy
Hence picking up right color combinations is the most important part
You must have used the border-radius property in CSS, but here is complete guide covering some of the hidden concept of it
π§΅ππ»
The border-radius CSS property rounds the corners of an element's outer border edge. You can set a border-radius in order to make round edges of sharp cornered box
Well we know that every element is a box in webpage. Consider that box clipped using 8 clips ππ»
We can adjust that clips in order to make distorted shapes