align image to left css code example

Example 1: how to center a div vertically and horizontally

.container{	
	margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
  	width: /* Define the width here; */
    height: /* Define the height here; */
}

/*You have to define the width and height! */

Example 2: centering horizontally

div.center{display:block;margin:auto;width:50%;}
p.center{text-align:center;}

Example 3: css align image right

<img style="float: right;" alt="" src="http://example.com/image.png" />

Example 4: how to align an image left in css

<div style="text-align: left"><img src="image/your-image.png" width="100" /></div>Copy

Tags:

Css Example