- Ritesh Ranjan
Every box have
- Height
- Width
- Padding
- Border
- Margin
width + padding-left + padding-right + border-left + border-right
height + padding-top + padding-bottom + border-top + border-bottom
box-sizing: content-box; /*Default*/ box-sizing: border-box; /* like quirks box*/
Just like the images in the print layout where the text flows around them.
Floated elements remain a part of the flow of the web page.
.clearfix {
clear: both;
}
<div style="clear: both;"></div>
.clearfix:after {
content: " ";
display: block;
height: 0;
clear: both;
}
.container {
display: flex; /* or inline-flex */
flex-direction: row | row-reverse | column | column-reverse;
flex-wrap: nowrap | wrap | wrap-reverse;
justify-content: flex-start | flex-end | center
| space-between | space-around;
align-content: flex-start | flex-end | center
| space-between | space-around | stretch;
align-items: flex-start | flex-end | center | baseline | stretch;
}
.item {
order: <integer>;
flex-grow: <number>;/* default 0 */
flex-shrink: <number>; /* default 1 */
flex-basis: <length> | auto; /* default auto */
flex: none | [ <'flex-grow'> <'flex-shrink'>?
|| <'flex-basis'> ];
align-self: auto | flex-start | flex-end
| center | baseline | stretch;
}
<div id="parent">
<div id="child">Text here</div>
</div>
#child {
line-height: 200px;
}
<div id="parent">
<div id="child">Text here</div>
</div>
#parent {display: table;}
#child {
display: table-cell;
vertical-align: middle;
}
<div id="parent">
<div id="child">Text here</div>
</div>
#parent {position: relative;}
#child {
position: absolute;
top: 50%;
left: 50%;
height: 30%;
width: 50%;
margin: -15% 0 0 -25%;
}
<div id="parent">
<div id="child">Text here</div>
</div>
#parent {
padding: 5% 0;
}
#child {
padding: 10% 0;
}