CSS Align

Horizontal Alignment:

Left Alignment:

Aligns text or inline elements to the left.

                          
                            p {
                                text-align: left;
                            }                                                                                                                                                                                                                                                                                                                                                                                                                              
                          
                        

Center Alignment:

Centers text or inline elements horizontally.

                          
                            h1 {
                                text-align: center;
                            }                                                                                                                                                                                                                                                                                                                                                                                                                                   
                          
                        

Right Alignment:

Aligns text or inline elements to the right.

                          
                            div {
                                text-align: right;
                            }                                                                                                                                                                                                                                                                                                                                                                                                                                  
                          
                        

Justify Alignment:

Stretches the strains so that every line has same width (besides the ultimate line).

                          
                            p {
                                text-align: justify;
                            }                                                                                                                                                                                                                                                                                                                                                                                                                                                              
                          
                        

Vertical Alignment:

Vertical Align Middle:

Vertically aligns inline or inline-block elements to the middle.

                          
                            img {
                                vertical-align: middle;
                            }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                          
                        

Vertical Align Top:

Aligns inline or inline-block elements to the top.

                          
                            span {
                                vertical-align: top;
                            }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                          
                        

Vertical Align Bottom:

Aligns inline or inline-block elements to the bottom.

                          
                            button {
                                vertical-align: bottom;
                            }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                          
                        

Vertical Align Text Bottom:

Aligns the baseline of the element to the bottom of the line height.

                          
                            strong {
                                vertical-align: text-bottom;
                            }