CSS小项目九宫格

<!DOCTYPE html>
<!-- 九宫格 -->
<html>
    <style>
        ul {
            position: fixed;/* 相对页面的位置固定 */
            top: 50%;
            left: 50%;
            text-align: center;/* 居中 */
            transform: translate(-50%,-50%);
            overflow: hidden;/*溢出元素内容区的内容,会被修剪,并且其余内容是不可见的*/
            list-style: none; /*去掉列表前方的点 */
            width: 200px;
            height: 200px;
            border: 2px solid rgb(126, 148, 26);
            padding: 0px;/*内边距*/

        }
        li {
            width: 33.3333333%;
            height: 33.333333%;
            float: left;
            background: rgb(196, 192, 255);
            color: white;
            border: 1px solid white;
            flex-wrap: nowrap;
            box-sizing: border-box;/*将 box-sizing 设置为 "border-box*,并排放置带边框的框*/
            display: flex;/*弹性布局*/
            align-items: center; /*flex容器属性*/
            justify-content: center;/*flex容器属性*/
        }
    </style>
    <body>
        <div>
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
                <li>6</li>
                <li>7</li>
                <li>8</li>
                <li>9</li>
            </ul> 
        </div>
    </body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值