首頁 > web前端 > css教學 > 主體

Yumma CSS - 現代 CSS 框架的新替代品

PHPz
發布: 2024-09-03 10:33:55
原創
443 人瀏覽過

Yumma CSS - The new alternative to modern CSS Frameworks

如果您熟悉 Bootstrap 和 Tailwind CSS,您就會知道調試程式碼庫有多麼困難,尤其是當您開發大型應用程式時。老實說,我參與的每個 Bootstrap 或 Tailwind CSS 專案最終都有太多的程式碼行,而且到了我對這種方法感到厭倦的地步。

Yumma CSS 比較如何?

Yumma CSS 使用縮寫命名約定,類似於常規 CSS 語法。

使用 Flexbox 居中

讓我們看看如何在這些框架中使用 Flex box 進行居中:

使用 Bootstrap

<div class="align-items-center d-flex justify-content-center">...</div>
登入後複製

使用 Tailwind CSS

<div class="items-center flex jc-c">...</div>
登入後複製

用 Yumma CSS

<div class="ai-c d-f jc-c">...</div>
登入後複製

媒體查詢與變體

Yumma CSS 提供了一組偽類和響應式斷點,例如 sm:*、md:*、lg:*、xl:* 和 xxl:*。這使得您可以輕鬆地根據螢幕尺寸和用戶互動來調整您的設計。

建築構件

讓我們看看在建立卡片網格元件時,Yumma CSS 與 Tailwind CSS 相比如何。

Tailwind CSS 卡

<div class="grid h-screen w-full gap-4 p-6 md:grid-flow-dense md:grid-cols-3 md:grid-rows-3">
    <div
        class="flex flex-col overflow-hidden rounded-xl border border-gray-200 bg-white p-6 shadow-lg md:col-span-1 md:row-span-2">
        <div class="flex-grow">
            <h1 class="mb-2 text-2xl font-semibold text-gray-800">
                Yumma OS 7.2
            </h1>
            <p class="mb-4 text-sm text-gray-600">
                This update has some important bug fixes and also fixes an issue that
                was preventing users from enabling or disabling Advanced Data Protection.
            </p>
            <a class="text-sm text-pink-500 underline" href="/">
                What's new?
            </a>
        </div>
        <div class="mt-auto flex flex-col space-y-4">
            <button class="h-12 rounded-md bg-pink-600 px-6 font-semibold text-white">
                Update Now
            </button>
            <button class="h-12 rounded-md border border-gray-200 px-6 font-semibold text-gray-900">
                Update Tonight
            </button>
        </div>
    </div>

    <div class="flex flex-col overflow-hidden rounded-xl border border-gray-200 bg-white p-6 shadow-lg md:col-start-2 md:row-start-1">
        <div class="flex-grow">
            <h1 class="mb-2 text-2xl font-semibold text-gray-800">
                Patch 6.2
            </h1>
            <p class="mb-4 text-sm text-gray-600">
                This update fixes security issues. Install it to keep your system safe.
            </p>
        </div>
        <button class="mb-4 mt-auto h-12 rounded-md bg-pink-600 px-6 font-semibold text-white">
            Update Now
        </button>
    </div>

    <div class="flex flex-col overflow-hidden rounded-xl border border-gray-200 bg-white p-6 shadow-lg md:col-start-2 md:row-start-2">
        <div class="flex-grow">
            <h1 class="mb-2 text-2xl font-semibold text-gray-800">
                What's new?
            </h1>
            <p class="mb-4 text-sm text-gray-600">
                Take a look at the new features in the latest release, including better user interface elements and a more stable system.
            </p>
            <a class="text-sm text-pink-500 underline" href="/">
                Learn more
            </a>
        </div>
    </div>
</div>
登入後複製

Yumma CSS 卡

<div class="d-g h-1/1 w-full g-4 p-6 md:gaf-d md:gtc-3 md:gtr-3">
    <div class="d-f fd-c ovf-h rad-3 b-1 bc-l-silver-6 bg-white p-6 bs-sm md:gc-s-1 md:gr-s-2">
        <div class="fg-1">
            <h1 class="mb-2 fs-xl fw-600 tc-d-lead-2">
                Yumma OS 7.2
            </h1>
            <p class="mb-4 fs-sm tc-l-lead-3">
                This update has some important bug fixes and also fixes an issue that was preventing users from enabling or disabling Advanced Data Protection.
            </p>
            <a class="fs-sm tc-pink tdl-u" href="/">
                What's new?
            </a>
        </div>
        <div class="mt-auto d-f fd-c s-y-4">
            <button class="h-12 rad-2 bg-pink px-6 fw-600 tc-white">
                Update Now
            </button>
            <button class="h-12 rad-2 b-1 bc-l-silver-5 px-6 fw-600 tc-lead">
                Update Tonight
            </button>
        </div>
    </div>

    <div class="d-f fd-c ovf-h rad-3 b-1 bc-l-silver-6 bg-white p-6 bs-sm md:gcs-2 md:grs-1">
        <div class="fg-1">
            <h1 class="mb-2 fs-xl fw-600 tc-d-lead-2">
                Patch 6.2
            </h1>
            <p class="mb-4 fs-sm tc-l-lead-3">
                This update fixes security issues. Install it to keep your system safe.
            </p>
        </div>
        <button class="h-12 rad-2 bg-pink px-6 fw-600 tc-white mt-auto mb-4">
            Update Now
        </button>
    </div>

    <div class="d-f fd-c ovf-h rad-3 b-1 bc-l-silver-6 bg-white p-6 bs-sm md:gcs-2 md:grs-2">
        <div class="fg-1">
            <h1 class="mb-2 fs-xl fw-600 tc-d-lead-2">
                What's new?
            </h1>
            <p class="mb-4 fs-sm tc-l-lead-3">
                Take a look at the new features in the latest release, including better user interface elements and a more stable system.
            </p>
            <a class="fs-sm tc-pink tdl-u" href="/">
                Learn more
            </a>
        </div>
    </div>
</div>
登入後複製

可維護性和可擴充性

當您從事一個大專案時,能夠維持您的工作非常重要。這就是我們將 Yumma CSS 設計為模組化和可擴展的原因。對於使用 React 或 Vue 等現代框架的應用程式來說,這是一個不錯的選擇。其簡潔的類別名稱和有組織的結構可幫助您保持樣式易於管理和程式碼整潔。

Yumma CSS Property
ai-c align-items: center;
bg-blue background-color: #3575dd;
d-f display: flex;
jc-c justify-content: center;
m-4 margin: 1rem;
p-4 padding: 1rem;
rad-1 border-radius: 4px;
ta-c text-align: center;
tc-white color: #ffffff;
w-full width: 100%;

結論

Yumma CSS 致力於在樣式方面保持簡單和簡約。它確實可以幫助減少程式碼的複雜性和冗長性。它的命名約定和模組化設計非常簡潔,使其成為現代 Web 開發的絕佳工具。試試 Yumma CSS,看看它如何幫助您更有效率地完成專案!

了解更多關於 Yumma CSS 的資訊

以上是Yumma CSS - 現代 CSS 框架的新替代品的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:dev.to
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!