zoukankan      html  css  js  c++  java
  • 54.纯 CSS 创作一副国际象棋

    原文地址:https://segmentfault.com/a/1190000015310484

    感想:棋盘是 CSS 画的,棋子是 unicode 字符。

    HTML code:

    <html>
        <head>
            <link rel="stylesheet" href="index.css">
            <title>棋盘是 CSS 画的,棋子是 unicode 字符。</title>
        </head>
        <body>
            <!-- 定义 dom,一共 8 个列表,每个列表包含 8 个元素 -->
            <!-- 可以搜索象棋符:https://unicode-table.com/cn/sets/ -->
            <!-- 博客园:http://www.cnblogs.com/change-oneself/p/5329837.html -->
            <div class="chess">
                <ul>
                    <li>&#9820;</li>
                    <li>&#9822;</li>
                    <li>&#9821;</li>
                    <li>&#9819;</li>
                    <li>&#9818;</li>
                    <li>&#9821;</li>
                    <li>&#9822;</li>
                    <li>&#9820;</li>
                </ul>
                <ul>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                </ul>
                <ul>
                    <li></li><li></li><li></li><li></li>
                    <li></li><li></li><li></li><li></li>
                </ul>
                <ul>
                    <li></li><li></li><li></li><li></li>
                    <li></li><li></li><li></li><li></li>
                </ul>
                <ul>
                    <li></li><li></li><li></li><li></li>
                    <li></li><li></li><li></li><li></li>
                </ul>
                <ul>
                    <li></li><li></li><li></li><li></li>
                    <li></li><li></li><li></li><li></li>
                </ul>
                <ul>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                    <li>&#9823;</li>
                </ul>
                <ul>
                    <li>&#9820;</li>
                    <li>&#9822;</li>
                    <li>&#9821;</li>
                    <li>&#9819;</li>
                    <li>&#9818;</li>
                    <li>&#9821;</li>
                    <li>&#9822;</li>
                    <li>&#9820;</li>
                </ul>
            </div>
        </body>
    </html>

    CSS code:

    html, body, ul {
        margin: 0;
        padding: 0;
    }
    /* body子元素水平垂直居中 */
    body{
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: darkslategray;
    }
    /* 设置.chess容器的样式 */
    .chess{
        font-size: 32px;
        background-color: burlywood;
        border: 0.2em solid tan;
        box-shadow: 0 0.3em 2em 0.4em rgba(0, 0, 0, 0.3);
    }
    /* 画出网格状棋盘 */
    .chess ul{
        display: table;
    }
    .chess ul:nth-child(-n+2) {
        color: black;
    }
    .chess ul:nth-child(n+7) {
        color: white;
    }
    .chess ul li{
        display: table-cell;
        width: 1.5em;
        height: 1.5em;
        text-align: center;
        line-height: 1.5em;
        /* 给字符(符号)加粗 */
        font-weight: bold;
    }
    /* 设置网格交错的颜色 */
    .chess ul:nth-child(odd) li:nth-child(even),
    ul:nth-child(even) li:nth-child(odd){
        background-color: rgba(0, 0, 0, 0.6);
    }
  • 相关阅读:
    004 RequestMappingHandlerMapping
    003 HandlerMapping
    002 环境配置
    001 springmvc概述
    011 使用AOP操作注解
    010 连接点信息
    009 通知类型
    一台服务器的IIS绑定多个域名
    程序包需要 NuGet 客户端版本“2.12”或更高版本,但当前的 NuGet 版本为“2.8.50313.46”
    通过ping 主机名,或者主机名对应的IP地址
  • 原文地址:https://www.cnblogs.com/FlyingLiao/p/10606034.html
Copyright © 2011-2022 走看看