DIV+CSS中的表格问题 请高手分析下代码以及优化下

来源:百度知道 编辑:UC知道 时间:2024/06/02 02:33:21
DIV+CSS中的表格中的h1怎么才能使它居中显示我设置了text-align:center无效高手帮忙怎么才能居中。
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
* { margin:0; padding:0;}
table { width:550px; margin:0 auto; border:#000 1px solid; border-collapse:collapse; font-size:12px;}
td { text-align:center; padding:10px; border:#0F0 1px dashed;}
th { color:#3366CC; background:#F4FD8E;}
h1 { color:#0000FF;}

</style>
</head>

把这个代码<center><h1>课程表</h1></center>把它放到<table width="794">上就可以了。

或者是<h1>课程表</h1>放到<table>上,然后给h1{text-aligh:center;}也就可以了。

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
* { margin:0; padding:0;}
table { width:550px; margin:0 auto; border:#000 1px solid; border-collapse:collapse; font-size:12px;}
td { text-align:center; padding:10px; border:#0F0