<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>CSS Position positioning achieves DIV in the center of the window</title>
<style type="text/css">
.dialog{
position: fixed;
_position:absolute;
z-index:1;
top: 50%;
left: 50%;
margin: -141px 0 0 -201px;
width: 400px;
height:280px;
border:1px solid #CCC;
line-height: 280px;
text-align:center;
font-size: 14px;
background-color:#F4F4F4;
overflow:hidden;
}
</style>
</head>
<body>
<div class="dialog">
I am in the center of the window, huh!
</div>
<p style="height:1500px;">float in CSS To achieve the optimization of front-end performance mentioned in the previous HACK article, we must have a solid technical foundation of CSS. Optimizing code performance requires a solid understanding of the basics, such as individual CSS properties and selectors. Due to the limited space, I can't introduce each CSS property one by one. For the specific content, you need to read the "CSS Authoritative Guide" and read the CSS standard document of W3C.
</p>
</body>
</html>