npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

darwin-flex-layout

v5.0.5

Published

da-flex布局方案

Downloads

60

Readme

darwin-flex-layout

npm version jsdelivr

darwin-flex-layout是一套从多个完整成熟的大型项目总结出来的页面布局最佳实践方案,开箱即用。

基于flex实现了纯className即可简单快速搭建基础页面结构,降低了重复编写布局代码的时间,提高了开发效率。

除了提供flex布局方案,还有一些比较常见的工具类,例如设备平台的判断,样式重置,屏幕尺寸适配,以及精简的前端路由控制器等,特别适合应用在活动页面里面

文档地址:https://rockey2020.github.io/darwin-flex-layout/

导航

安装方式

使用 npm:

$ npm install darwin-flex-layout -S

使用 yarn:

$ yarn add darwin-flex-layout

使用 pnpm:

$ pnpm add darwin-flex-layout

使用 jsDelivr CDN:


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/darwin-flex-layout/dist/legacy/all/index.css">
<script src="https://cdn.jsdelivr.net/npm/darwin-flex-layout/dist/legacy/all/index.js"></script>

使用例子(基于npm安装)

import Da from "darwin-flex-layout/dist/default/all" //推荐 默认导入样式  可通过Da调用附属工具类 同时默认在window挂载附属的工具类
import "darwin-flex-layout/dist/default/all"//默认在window挂载附属的工具类 默认导入样式
//又或者 导入自己想要的css或者js default下的任意目录都是独立的模块 可以按需导入

使用例子(基于浏览器引入方式安装)


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/darwin-flex-layout/dist/legacy/all/index.css">
<script src="https://cdn.jsdelivr.net/npm/darwin-flex-layout/dist/legacy/all/index.js"></script>
<!--会在window对象上挂载一个Da对象,可通过Da调用对应的工具类-->
<!--与npm安装方式一样,支持单独模块的注册引用,只需要修改对应的引用文件地址-->

DaFlex基本类名规则

所有的flex布局类名前缀都会有 da-flex

任何的包含 da-flex 的元素 都默认是垂直 左对齐

类名完全遵守flex属性命名规则例如 da-flex da-flex-inline da-flex-justify-center

只有任意父级元素className包含了 da-flex 子级的附属类名才会生效 例如父级有da-flex 子级使用da-flex-justify-center会生效 否则无效

da-flex-item 基于百分比宽度实现了从0-100的宽度类名 例如 da-flex-item-50 就是宽度为50%

声明一个占满一行的div 内部包含两个垂直居中的盒子 且该行会自动换行
<div class="da-flex da-flex-wrap">
    <div class="da-flex da-flex-inline da-flex-item-50 da-flex-justify-center">
        <span>盒子1</span>
    </div>
    <div class="da-flex da-flex-inline da-flex-item-50 da-flex-justify-center">
        <span>盒子2</span>
    </div>
</div>

声明一个占满一行的div 内部包含两个垂直居中的盒子 且该div是一个列表模式
<div class="da-flex da-flex-column">
    <div class="da-flex da-flex-inline da-flex-item-100 da-flex-justify-center">
        <span>盒子1</span>
    </div>
    <div class="da-flex da-flex-inline da-flex-item-100 da-flex-justify-center">
        <span>盒子2</span>
    </div>
</div>

License

MIT