Q:

css center position

.container{
  display: table;
}

.div-inside-container{
  display: table-cell;
  vertical-align: middle;
}
3
div.center{display:block;margin:auto;width:50%;}
p.center{text-align:center;}
3

/**************** 1º method to center all elements ********************/
body {                   
  text-align: center;
}

/* If all of your elements have the property display equal to "inline", 
"block" or "inline-block", then you can use the text-align: center in
the <body> tag */

tag_name {
    display: inline; /* block or inline-block*/
}

/*...but if we have an element of type "block" with a width diferente
from the default (maximum width of the page), then this will no 
longer work!*/
  
tag_name {
    display: block;
  	width: 170px;
}


/**************** 2º method to center all elements ********************/
/* Another method, is to use the margins to center the element 
horizontally and/or vertically */

tag_name {
    display: block;
  	width: 100px;
  	margin: 0 auto 0 auto;  /* top, right, bottom, left */
}

1
<!--center text-->
<!DOCTYPE html>
<html>
<head>
<style>
.center {
  text-align: center;
  border: 3px solid green;
}
</style>
</head>
<body>

<h2>Center Text</h2>

<div class="center">
  <p>This text is centered.</p>
</div>

</body>
</html>
1

    img.a {
  vertical-align: baseline;
}

img.b {
  vertical-align: text-top;
}

img.c {

      
    vertical-align: text-bottom;
}

img.d {
  
    vertical-align: sub;
}

img.e {
  vertical-align: super;
}  
0

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

} 
-1

New to Communities?

Join the community