<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Div_CSS_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type ="text/css" >
#layout { width:778px; margin:0 auto; text-align:center; border:1px solid #44b6dc; background:#e1edfb; height:500px; line-height:500px;font-size:500px}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="layout">
<img src ="dd.jpg" align="absmiddle" />
</div>
</form>
</body>
</html>
要图片居中首先注意的:
height:500px; line-height:500px;
一定要加:
font-size:500px
但是在firefox里不支持。