Add extractor and builder
Tested and working
This commit is contained in:
@ -5,14 +5,10 @@ tags: layout,intermediate
|
||||
|
||||
Vertically and horizontally centers a child element within its parent element using `position: absolute` and `transform: translate()` (as an alternative to `flexbox` or `display: table`). Similar to `flexbox`, this method does not require you to know the height or width of your parent or child so it is ideal for responsive applications.
|
||||
|
||||
#### HTML
|
||||
|
||||
```html
|
||||
<div class="parent"><div class="child">Centered content</div></div>
|
||||
```
|
||||
|
||||
#### CSS
|
||||
|
||||
```css
|
||||
.parent {
|
||||
border: 1px solid #333;
|
||||
@ -30,8 +26,6 @@ Vertically and horizontally centers a child element within its parent element us
|
||||
}
|
||||
```
|
||||
|
||||
#### Demo
|
||||
|
||||
#### Explanation
|
||||
|
||||
1. `position: absolute` on the child element allows it to be positioned based on its containing block.
|
||||
|
||||
Reference in New Issue
Block a user