(内有html代码)怎么让div里的文字在div中垂直居中(内有html代码)[急...]

xixi99 2003-10-08 09:40:36
缺省时div里的文字总是垂直顶部对齐

请看:
<html>
<body bgcolor="#FFFFFF" text="#000000">
<table width="200" border="0" height="241">
<tr>
<td height="159" >
<div id="div1" style="position:absolute; width:181px; height: 94px; background-color: #CCCCCC;">
我爱我家
</div>
</td>
</tr>
</table>
</body>
</html>
===================================================

怎么办??
...全文
624 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xixi99 2003-10-09
  • 打赏
  • 举报
回复
ok,那就采用加table的方式!

结碟!
希默软件 2003-10-09
  • 打赏
  • 举报
回复
当前好像只有这样嵌套,DIV没有这样的样式
xixi99 2003-10-08
  • 打赏
  • 举报
回复
楼上,难道css没有相关的属性来改变div里文字的垂直对齐方式吗?

=========================

因为我的div里的内容是动态变化的,根据数据库里取出什么内容(比如:我爱我家)就放什么内容,如果还要在div里写入一个表格,可能有点麻烦!

=========================
孟子E章 2003-10-08
  • 打赏
  • 举报
回复
<html>
<body bgcolor="#FFFFFF" text="#000000">
<table width="200" border="0" height="241">
<tr>
<td height="159">
<div id="div1" style="position:absolute; width:181px; height: 94px; background-color: #CCCCCC;">
<table height="100%" width="100%">
<tr><td align=center>
我爱我家
</td></tr></table>
</div>
</td>
</tr>
</table>
</body>
</html>
孟子E章 2003-10-08
  • 打赏
  • 举报
回复
<html>
<body bgcolor="#FFFFFF" text="#000000">
<table width="200" border="0" height="241">
<tr>
<td height="159" valign='middle' align=center style=" background-color: #CCCCCC;">
我爱我家

</td>
</tr>
</table>
</body>
</html>

61,125

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧