0
Q:

text vertical align css

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style type="text/css">
      div {
        display: table-cell;
        width: 250px;
        height: 200px;
        vertical-align: middle;
      }
    </style>
  </head>
  <body>
    <div>Vertically aligned text</div>
  </body>
</html>
10
/* HTML: */
<div class="text">
lorem ipsum
</div>


/* CSS: */
.text {
vertical-align: middle;
/*can take any value of:
baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length> */
}

3
.parent-class {
  display: flex;
  align-items: center;
  justify-content: space-around;
}
3
.top-align {
	vertical-align: top;
}  

.center-align {
  	vertical-align: middle;
}
8
/* Answer to: "css vertical align middle" */

/*
  Go to: https://www.w3schools.com/css/css_align.asp
  Here you can learn many ways to align horizontal and vertically!
  My favourite method is below:
*/

.center {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  border: 3px solid green;
}
5
# center text
.center {
  text-align: center;
  
border: 3px solid green;
} 
1

.center {
  padding: 70px 0;
  border: 3px solid 
green;
  text-align: center;

} 
-1

New to Communities?

Join the community