Answers for "css to center align page content"

3

css center text in div

/* For horizontal align: */
parent-element {text-align:center;}
/* For horizontal and vertical align: */
parent-element {position: relative;}
element-to-be-centered {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* See https://www.w3schools.com/css/css_align.asp for more info */
Posted by: Guest on October-25-2020
2

css centraliz page

Use a container element and set a specific max-width.
A common width many websites use is 960px.
To actually center the page, add margin: auto.
The following example will center the website on screens that are wider than
500px.On screens that are less than 500px wide,
it will span the whole of the page:

<style>
.content {
  max-width: 500px;
  margin: auto;
}
</style>
<body>

<div class="content">
  <!-- Page content -->
</div>

</body>
Posted by: Guest on September-24-2020

Code answers related to "css to center align page content"

Browse Popular Code Answers by Language