div css如何实现子DIV里的多个子DIV水平居中?

[复制链接]
查看11 | 回复4 | 2011-5-6 12:21:22 | 显示全部楼层 |阅读模式
divclass=\"find_center\"
DIVid=\"find_button\"
DIVclass=\"find_button_left\"/DIV
DIVclass=\"find_button_center\"ahref=\"#\"查询查询查询查询查询查询查询/a/DIV
DIVclass=\"find_button_right\"/DIV
/DIV
DIVid=\"find_button\"
DIVclass=\"find_button_left\"/DIV
DIVclass=\"find_button_center\"ahref=\"#\"查询/a/DIV
DIVclass=\"find_button_right\"/DIV
/DIV
DIVid=\"find_button\"
DIVclass=\"find_button_left\"/DIV
DIVclass=\"find_button_center\"ahref=\"#\"查询查询查询查询查询查询/a/DIV
DIVclass=\"find_button_right\"/DIV
/DIV
/div


我要实现3个find_button水平剧中
回复

使用道具 举报

千问 | 2011-5-6 12:21:22 | 显示全部楼层
方法一:在这三个div中增加style=\"text-align:center;vertical-align:middle\"
方法二:增加样式
.find_centerdiv{
text-align:center;
vertical-align:middle
}

即可









<h4class=\"ask\">追问


试过了。。没有效果埃。。。
回复

使用道具 举报

千问 | 2011-5-6 12:21:22 | 显示全部楼层
你在css文件中查看一下find_centerdiv是否已经存在,如果重复了,以最上面定义的为准的。
你的find_button可以增加text-align:center
回复

使用道具 举报

千问 | 2011-5-6 12:21:22 | 显示全部楼层
不对埃。。。text-align:center只能定义内部剧中吧。。我要find_button这个DIV居中。。。find_centerdiv之前没有的。加了也没效果。。头疼死啦!!
回复

使用道具 举报

千问 | 2011-5-6 12:21:22 | 显示全部楼层
你的find_center等都没用定义div宽度,很可能造成已经居中,但是页面的效果都挤在左边,你要分清这两种情况哦.
比如你现在将find_center的宽度设置成1000px试试看?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行