运行结果尺寸: 300 x 150
x
 
<!DOCTYPE html>
<html>
<head>
<style>
img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
</style>
</head>
<body>
<h2>居中图像</h2>
<p>要使图像居中,请将左右边距设置为自动,并将其制成块元素。</p>
<img src="paris.jpg" alt="巴黎" style="width:50%">
</body>
</html>
×

报个问题: