flex vertical code example

Example 1: css flex vertical align

/* Answer to: "css flex vertical align" */

.box {
  display: flex;
  align-items: center; /* Vertical */
  justify-content: center; /* Horizontal */
}

.box div {
  width: 100px;
  height: 100px;
}

/*
  For more information go to:
  https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Aligning_Items_in_a_Flex_Container
*/

Example 2: display flex column

.container {
	display: flex;
	flex-direction: column;
}

Example 3: css flexbox syntax

Display: flex 
Flex-direction: row | row-reverse | column | column-reverse
align-self: flex-start | flex-end | center | baseline | stretch
justify-content: start |  center | space-between | space-around | space-evenly

Example 4: css vertical align with flexbox

<div class="align-vertically">
  I am vertically centered!
</div>


/*Css  */

.align-vertically {
  background: #13b5ea;
  color: #fff;
  display: flex;
  align-items: center;
  height: 200px;
}

Example 5: flex css end

.item {
  align-self:flex-start | flex-end | center | baseline | stretch;
}

Example 6: flex box in css

<!--basic--flex--layout-->
<html>
	<head>
		<style>
			.parent{
              display:  flex or inline-flex;
              flex-direction: row  or column;
              flex-wrap: wrap or wrap-reverse;
 			}
		</style>
	</head>
	<body>
		<div class="parent">
			<div class="child-1"></div>
			.
			.
			.
		</div>
	</body>
</html>

Tags:

Css Example