Posts

Different ways to align an image

Different ways to align an image - So, In this blog, I will tell you the different ways by which you can align an image by using  HTML  or  CSS . By using  float  property -  You can use float property of CSS to align an image to left or right. However, you cannot use float property to align an image to center. Use  float:left  to align an image to left and  float:right  to align an image to right. for example, see the codepen below  -  Note  - resize the codepen to  0.5*  to see the effect.   By using  Margin  property -  You can also use margin property of CSS to align the image in right, left or center. Use  margin-right:auto  to align the image to left,  margin-left:auto  to align the the image to right and  margin:auto  to align the image to center. But before that, set the display property of all the images to block. f...
Recent posts