Horizontally and Vertically Center-aligned static Content : p.content « Tags « HTML / CSS






Horizontally and Vertically Center-aligned static Content

   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title></title>
<style type="text/css" title="text/css">
.parent{
   width: 600px;
   height: 600px;
   background: gray;
}
#c {
  position: static;
  text-align: center;
  line-height: 48px;
  background: gold;
}
</style>
</head>
<body>
<div class="parent">
    <p id="c">Horizontally and Vertically Center-aligned Content</p> 
    
</div> 
</body>
</html>

   
    
  








Related examples in the same category

1.p content
2.Left-aligned static content
3.Right-aligned content
4.'contenteditable' determines whether an element can be edited or not