网站布局多样化是我们前端的拿手菜!最近看到uc浏览器的默认标签页使用的就是九宫格布局。就研究了下,在这里,我就分享一下代码,共同学习下!效果如下:
nbsp;html>全兼容的HTML九宫格布局 /** 重置浏览器默认标签样式 */ body,ul,li{margin:0;padding:0;} .xttblog{ width: 1200px; height: 170px; margin-top:50px; margin-left: auto; margin-right: auto; } .box{margin-left: 5px;margin-top: 5px;list-style-type:none;} .box:after{ content: "."; display: block; line-height: 0; width:0; height: 0; clear: both; visibility: hidden; overflow: hidden; } .box li{float:left;line-height: 230px;} .box li a,.box li a:visited{ display:block; border: 5px solid #ccc; width: 380px; height: 230px; text-align: center; margin-left: -5px; margin-top: -5px; position: relative; z-index: 1; } .box li a:hover{border-color: #f00;z-index: 2;}
以上就是本文的全部内容,希望对大家的学习有所帮助。
更多HTML九宫格布局实现方法相关文章请关注PHP中文网!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2836273.html