跳转至

# 网页圆角化设计

## 示例

## 如何设计

新建css文件，在mkdocs.yml引入css

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    :root {
      --admonition-border-left-width: 0.2rem;
      --base-border-radius: 0.5rem;
    }

    /* Change font family of filename present on top of code block. */
    /* .highlight span.filename {
      border-bottom: none;
      border-radius: var(--base-border-radius);
      display: inline;
      font-family: var(--md-code-font-family);
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
      margin-bottom: 5px;
      text-align: center;
    }
    .highlight span.filename + pre > code {
      border-radius: var(--base-border-radius);
      border-top-left-radius: 0;
    }
    .md-typeset pre > code {
      border-radius: var(--base-border-radius);
    } */

    /* Customize admonition layout */
    /* .md-typeset .admonition {
      border-width: 0px;
      border-left-width: var(--admonition-border-left-width);
    }

    [dir="ltr"] .md-typeset blockquote {
      border-radius: 0.2rem;
      border-left-width: var(--admonition-border-left-width);
    } */

    /* Grid Cards */
    .md-typeset .grid.cards > ul > li {
      border-radius: var(--base-border-radius);
    }
    .md-typeset .grid.cards > ul > li:hover {
      box-shadow: 0 0 0.2rem #ffffff40;
    }

    /* Markdown Button */
    .md-typeset .md-button {
      border-radius: var(--base-border-radius);
    }

    /* Footer: Social Links */
    .md-social__link svg {
      max-height: 1rem;
    }

    /* Forms */
    .md-search__form {
      border-radius: var(--base-border-radius);
    }

    [data-md-toggle="search"]:checked ~ .md-header .md-search__form {
      border-top-right-radius: var(--base-border-radius);
      border-top-left-radius: var(--base-border-radius);
    }

    [dir="ltr"] .md-search__output {
      border-bottom-right-radius: var(--base-border-radius);
      border-bottom-left-radius: var(--base-border-radius);
    }

    /* Blog - index.md */
    /* div.md-content header {
      display: none;
    }

    .md-post--excerpt {
      background-color: var(--md-accent-fg-color--transparent);
      box-shadow: 0 0 0 1rem var(--md-accent-fg-color--transparent);
      border-radius: var(--base-border-radius);
    }

    .md-post--excerpt .md-post__header {
      justify-content: center;
    }

    .md-post--excerpt .md-post__content > h2,
    .md-post__action {
      text-align: center;
    } */

    /* Table */
    .md-typeset table:not([class]) {
      border-radius: var(--base-border-radius);
    }

    .carousel {
      width: 60%;
      height: 100%;

      border-radius: 0.4rem;
      overflow: hidden;
      position: relative;

      /* 居中 */
      margin-left: auto;
      margin-right: auto;

      border: 0.075rem solid #7b7b7b7a;
      box-shadow: var(--md-shadow-z1);
    }

    .carousel-container {
      width: 100%;
      height: 100%;

      position: relative;
      left: 0;

      display: flex;

      /* 过渡动画 1s */
      transition: all 1s;
    }

    .carousel-hover {
      height: 100%;
      width: 10%;
      position: absolute;
      top: 0;

      /* 子元素垂直居中 */
      display: flex;
      flex-flow: column nowrap;
      align-items: center;
      justify-content: center;
    }
    .carousel-hover.left {
      left: 0;
    }
    .carousel-hover.right {
      right: 0;
    }

    .carousel-hover button {
      background-color: var(--md-accent-fg-color);
      border-radius: 50%;

      cursor: pointer;

      opacity: 0;
      transition: opacity 0.3s;
    }
    .carousel-hover button::after {
      display: block;
      height: 1.5rem;
      width: 1.5rem;

      background-color: white;
      content: "";
      mask-position: center;
      -webkit-mask-position: center;
    }
    .carousel-hover.left button::after {
      mask-image: var(--md-tabbed-icon--prev);
      -webkit-mask-image: var(--md-tabbed-icon--prev);
    }
    .carousel-hover.right button::after {
      mask-image: var(--md-tabbed-icon--next);
      -webkit-mask-image: var(--md-tabbed-icon--next);
    }

    /* hover 外层 */
    .carousel-hover:hover button {
      opacity: 0.5;
      transition: opacity 0.3s;
    }
    /* hover 内层 */
    .carousel-hover button:hover {
      opacity: 0.8;
      transition: opacity 0.3s;
    }

    .carousel-container a {
      width: 100%;
      height: 100%;

      flex-shrink: 0;
    }

    .carousel-container img {
      width: 100%;
      height: 100%;

      object-fit: cover;
      display: block;
    }

    .carousel-bottom {
      position: absolute;
      /* 宽度等同于内容宽度 */
      width: 100%;
      padding: 20px;

      bottom: 0;

      display: flex;
      justify-content: center;
      /* 指示器间距 */
      gap: 10px;

      opacity: 0;
      transition: opacity 0.3s;
    }
    .carousel-bottom:hover {
      opacity: 0.8;
      transition: opacity 0.3s;
    }

    .carousel-bottom .indicator {
      height: 5px;
      width: 20px;

      background-color: var(--md-accent-fg-color);

      opacity: 0.5;
      cursor: pointer;
    }

    .carousel:hover .bottom .indicator {
      opacity: 1;
    }
    .carousel:hover .shift .btn {
      opacity: 1;
    }

    @media screen and (max-width: 600px) {
      .carousel {
          width: 100%;
      }

      .carousel-hover button {
          opacity: 1;
      }
    }

## 利用内置的grid cards

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    <div class="grid cards" markdown>

    -   :simple-materialformkdocs:{ .lg .middle } __Mkdocs教程__

        ---

        - [利用Mkdocs部署静态网页至GitHub pages](blog/Mkdocs/mkdocs1.md)
        - [Mkdocs部署配置说明(mkdocs.yml)](blog/Mkdocs/mkdocs2.md)
        - [如何给MKdocs添加友链](blog/websitebeauty/linktech.md)
        - [网站添加Mkdocs博客](blog/Mkdocs/mkdocsblog.md)
        - [Blogger](blog/index.md)
    </div>

效果：

- Mkdocs教程

  示例文字

## 按钮

    1
    [Send Email :fontawesome-solid-paper-plane:](mailto:<wangkewen821@gmail.com>){.md-button}

效果：
Send Email
2024-04-26
GitHub
此页面有帮助吗？
谢谢你的反馈！
Thanks for your feedback! Help us improve this page by using our feedback form.