--- title: Layout Horizontal and Vertical Align --- ## Layout Horizontal and Vertical Align CSS has properties that create space both around and inside an element. You will use one, or a combination of these properties to create layouts. ### Properties Used To Create Layouts You will use the following properties to align elements and create layouts: - [margin](https://guide.freecodecamp.org/css/margins/) - [position](https://guide.freecodecamp.org/css/css-position) - [float and clear](https://guide.freecodecamp.org/css/layout/float-and-clear) - [text-align](https://guide.freecodecamp.org/css/text-align) - [padding](https://guide.freecodecamp.org/css/padding) - [line-height](https://guide.freecodecamp.org/css/text) ### Horizontal Align The `margin` property will create space around an element. Use the `auto` value to equally distribute remaining space on either side. ```css .horizontal-center { margin: auto; } ``` `Block` elements must have a `width` set to avoid filling the viewport: ```html
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.