1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      使用純CSS實(shí)現(xiàn)一張紀(jì)念卓別林卡片的方法是什么-創(chuàng)新互聯(lián)

      這篇文章給大家分享的是有關(guān)使用純CSS實(shí)現(xiàn)一張紀(jì)念卓別林卡片的方法是什么的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考。一起跟隨小編過來看看吧。

      創(chuàng)新互聯(lián)主要從事成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)翠屏,十載網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):028-86922220效果預(yù)覽

      使用純CSS實(shí)現(xiàn)一張紀(jì)念卓別林卡片的方法是什么

      源代碼下載

      https://github.com/comehope/front-end-daily-challenges

      代碼解讀

      定義 dom,容器中包含的 3 個(gè)元素分別代表帽子、胡須和手杖:

      居中顯示:

      body {
          margin: 0;
          height: 100vh;
          display: flex;
          align-items: center;
          justify-content: center;
      }

      定義容器尺寸,并設(shè)置子元素水平居中:

      .chaplin {
          width: 40em;
          height: 30em;
          font-size: 10px;
          background-color: #eee;
          box-shadow: 0 0 3em rgba(0, 0, 0, 0.2);
          display: flex;
          flex-direction: column;
          align-items: center;
      }

      定義默認(rèn)顏色,后面用currentColor引用此顏色:

      .chaplin {
          color: #555;
      }

      畫出帽子的輪廓:

      .chaplin {
          position: relative;
      }
      .hat {
          position: absolute;
          width: 6.4em;
          height: 4.6em;
          background-color: currentColor;
          border-radius: 2.3em 2.3em 0 0;
          top: 1.4em;
      }

      用偽元素畫出帽沿:

      .hat::before {
          content: '';
          position: absolute;
          width: 10em;
          height: 0.8em;
          background-color: currentColor;
          border-radius: 0.4em;
          top: calc(100% + 0.4em);
          left: calc((100% - 10em) / 2);
      }

      畫出胡子:

      .beard {
          position: absolute;
          width: 1.5em;
          height: 0;
          top: 11.6em;
          border: solid transparent;
          border-width: 0 0.4em 1em 0.4em;
          border-bottom-color: currentColor;
      }

      畫出手杖的杖桿:

      .stick {
          position: absolute;
          width: 0.8em;
          height: 10.5em;
          background-color: currentColor;
          bottom: 0;
      }

      ::before偽元素畫出手杖的握柄:

      .stick::before {
          content: '';
          position: absolute;
          box-sizing: border-box;
          width: 5.6em;
          height: 3em;
          border: 0.8em solid;
          border-radius: 5.6em 5.6em 0 0;
          border-bottom: none;
          top: -3em;
      }

      ::after偽元素修飾握柄的端點(diǎn),使其圓潤自然:

      .stick::after {
          content: '';
          position: absolute;
          width: 0.8em;
          height: 0.8em;
          background-color: currentColor;
          border-radius: 50%;
          left: calc(5.6em - 0.8em);
          top: -0.4em;
      }

      使手杖水平居中:

      .stick {
          left: calc((100% - (5.6em - 0.8em)) / 2);
      }

      至此,抽象的卓別林形象完成,接下來排版一句他的名言。
      在 dom 中增加一個(gè).quote元素,并把一句話分為 3 段:

      a day without laughter is a day wasted

      定位文字,并豎排 3 段文字:

      .quote {
          position: absolute;
          left: 50%;
          bottom: 2.5em;
          font-family: sans-serif;
          text-transform: uppercase;
          font-weight: bold;
          display: flex;
          flex-direction: column;
      }

      調(diào)整字號(hào)和字間距,使 3 段文字對(duì)齊:

      .quote span:nth-child(1) {
          letter-spacing: 0.05em;
      }
      
      .quote span:nth-child(2) {
          font-size: 1.6em;
      }

      感謝各位的閱讀!關(guān)于使用純CSS實(shí)現(xiàn)一張紀(jì)念卓別林卡片的方法是什么就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!


      文章標(biāo)題:使用純CSS實(shí)現(xiàn)一張紀(jì)念卓別林卡片的方法是什么-創(chuàng)新互聯(lián)
      文章源于:http://www.ef60e0e.cn/article/jhpeh.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        儋州市| 沂水县| 南京市| 井冈山市| 元氏县| 湘西| 商洛市| 额济纳旗| 龙门县| 通海县| 梁山县| 鄂伦春自治旗| 高尔夫| 新余市| 卓尼县| 黄石市| 兴城市| 郧西县| 开平市| 石阡县| 五家渠市| 石楼县| 蒲城县| 扎兰屯市| 特克斯县| 徐州市| 长沙市| 卢龙县| 勃利县| 商丘市| 西吉县| 枣阳市| 屯昌县| 永兴县| 大洼县| 石河子市| 台东市| 东明县| 晋州市| 呼图壁县| 聂拉木县|