Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
    <section class="voteNumArea">
        <div class="TitleContainer">
            <span class="yearTitle">2024</span>
            <div class="titleInfo">
                <span class="thTitle">第<span class="thNum">16</span>屆</span>
                <span class="nameTitle">總統即時開票全台地圖</span>
            </div>
            <span class="smallMark">2024 Taiwan presidential election</span>
        </div>
        <div class="personAllArea">
            <div class="personContainer">
                <div class="rankNuBox">
                    <span class="rankcircle"></span>
                    <span class="rankNum">1</span>
                    <span class="rank1">暫時領先</span>
                </div>
                <div class="Group">台灣民主進步黨</div>
                <div class="peopleName">蔡英文/賴清德</div>
                <div class="voteRate">
                    <span class="rateCircle"><span class="blur"></span></span>
                    <span class="ratenum" dta-num="60">60%</span>
                </div>
                <div class="labelBarBox" data-rank="60%">
                    <span class="voteNum">1358萬1200票</span>
                    <span class="labelBar"></span>
                </div>
            </div>
            <div class="personContainer">
                <div class="rankNuBox">
                    <span class="rankcircle"></span>
                    <span class="rankNum">2</span>
                </div>
                <div class="Group">台灣民主進步黨</div>
                <div class="peopleName">蔡英文/賴清德</div>
                <div class="voteRate">
                    <span class="rateCircle"><span class="blur"></span></span>
                    <span class="ratenum" dta-num="30">30%</span>
                </div>
                <div class="labelBarBox" data-rank="30%">
                    <span class="voteNum">258萬1200票</span>
                    <span class="labelBar"></span>
                </div>
            </div>
            <div class="personContainer">
                <div class="rankNuBox">
                    <span class="rankcircle"></span>
                    <span class="rankNum">3</span>
                </div>
                <div class="Group">台灣民主進步黨</div>
                <div class="peopleName">蔡英文/賴清德</div>
                <div class="voteRate">
                    <span class="rateCircle"><span class="blur"></span></span>
                    <span class="ratenum" dta-num="10">10%</span>
                </div>
                <div class="labelBarBox" data-rank="10%">
                    <span class="voteNum">58萬1200票</span>
                    <span class="labelBar"></span>
                </div>
            </div>
        </div>
    </section>
    <!-- <section class="VoteMapArea">
        <div>map</div>
    </section> -->


              
            
!

CSS

              
                :root {
        --title-color: #000;
    }

    .voteNumArea {
        width: 50%;
    }

    /* title區塊 */
    .TitleContainer {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-block: 50px;
    }

    .yearTitle {
        display: block;
        color: var(--title-color);
        font-size: 3.5rem;
        font-weight: 400;
    }

    .smallMark {
        display: block;
        color: var(--title-color);
        font-size: 1rem;
        font-weight: 400;
    }

    .titleInfo {
        display: flex;
        align-items: center;
    }

    .thTitle {
        writing-mode: vertical-rl;
        line-height: 4.5rem;
    }

    .thNum {
        writing-mode: horizontal-tb;
    }

    .nameTitle {
        font-size: 3rem;
    }

    /* 個人區塊 */
    .personAllArea {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .personContainer {
        border-radius: 15px;
        border: 1px solid #FFF;
        background: rgba(132, 220, 130, 0.10);
        box-shadow: 0px 4px 4px 0px rgba(236, 234, 234, 0.25) inset;
        backdrop-filter: blur(5.5px);
        padding: 0 15px 20px 15px;
    }

    .personContainer:nth-of-type(1) {
        background: rgba(132, 220, 130, 0.10);
    }

    .personContainer:nth-of-type(2) {
        background: rgba(130, 193, 220, 0.10);
    }

    .personContainer:nth-of-type(3) {
        background: rgba(220, 189, 130, 0.10);
    }

    .rankNuBox {
        transform: translateY(-50%);
    }

    .rankNum {
        color: #FFC531;
        font-size: 1.5rem;
        font-style: italic;
        font-weight: 700;
        width: 30px;
        display: inline-block;
        text-align: center;
    }

    .rank1 {
        color: #000;
        font-size: 1.2rem;
        font-style: italic;
        font-weight: 700;
        letter-spacing: 3px;
        padding-left: 10px;
    }

    /* .personContainer:nth-of-type(1) .rankNum:after {
        content: "暫時領先";
        color: #000;
        font-size: 1.2rem;
        font-style: italic;
        font-weight: 700;
        letter-spacing: 3px;
        padding-left: 10px;
    } */

    .rankcircle {
        display: inline-block;
        width: 35px;
        height: 35px;
        border-radius: 50%;
        background-color: rgba(255, 230, 0, 0.3);
        filter: drop-shadow(0px 2.687986373901367px 2.687986373901367px rgba(0, 0, 0, 0.05));
        backdrop-filter: blur(1.3439931869506836px);
        position: absolute;
        z-index: -1;
    }

    .Group {
        color: #000;
        font-size: 1rem;
        font-weight: 400;
    }

    .peopleName {
        color: #000;
        font-size: 2rem;
        font-weight: 400;
    }

    .voteRate {
        text-align: right;
        position: relative;
    }

    .rateCircle {
        width: 55px;
        height: 55px;
        display: inline-block;
        border-radius: 50%;
        transform: translate(75%, -25%);
    }

    .personContainer:nth-of-type(1) .rateCircle {
        background: rgba(163, 229, 161, 1);
    }

    .personContainer:nth-of-type(2) .rateCircle {
        background: rgba(130, 177, 220, 1);
    }

    .personContainer:nth-of-type(3) .rateCircle {
        background: rgba(220, 173, 130, 1);
    }

    .rateCircle .blur {
        width: 55px;
        height: 55px;
        display: block;
        border-radius: 50%;
        stroke-width: 1px;
        stroke: #FFF;
        filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.05));
        backdrop-filter: blur(2px);
        overflow: hidden;
        transform: translate(-10px, 5px);
    }

    .ratenum {
        color: #000;
        font-size: 2.25rem;
        font-weight: 800;
        position: relative;
        transform: translate(-10%, -50%);
        display: inline-block;
    }

    .labelBarBox {
        text-align: right;
        display: flex;
        flex-direction: column;
    }

    .labelBar {
        height: 12px;
        box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.15);
    }

    .personContainer:nth-of-type(1) .labelBar {
        background: rgba(132, 220, 130, 1);
    }

    .personContainer:nth-of-type(2) .labelBar {
        background: rgba(130, 177, 220, 1);
    }

    .personContainer:nth-of-type(3) .labelBar {
        background: rgba(220, 173, 130, 1);
    }
              
            
!

JS

              
                    let labelBarBox = document.querySelectorAll(".labelBarBox");

    for (let onelabel of labelBarBox) {

        onelabel.style.width = onelabel.dataset.rank;
    }
              
            
!
999px

Console