css实现两边对齐

来源:互联网 发布:淘宝客服回复快捷短语 编辑:程序博客网 时间:2024/04/30 09:09
<!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:0px; padding:0px;}ul,li{ list-style:none;}img{ border:0px;}li{ float:left;}.xl_hot{ border:1px solid blue; width:960px; overflow:hidden; margin:100px auto; padding:10px 0px;}.xl_hot li{ margin-left:20px; display:inline; width:223px; border:1px solid red; height:223px;}.xl_hot ul{ margin-left:-20px;}</style></head><body><div class="xl_hot"><ul><li></li><li></li><li></li><li></li></ul></div></body></html>
在ie6下,会出现错位,修改.xl_hot ul{ margin-left:-20px; zoom:1}即可。