首页 >web前端 >css教程 >Yumma CSS - 现代 CSS 框架的新替代品

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

PHPz
PHPz原创
2024-09-03 10:33:55492浏览

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中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn