Giter Site home page Giter Site logo

Comments (14)

lzxb avatar lzxb commented on May 13, 2024

@zerofront 对flex布局初学者来说,各种兼容性入坑少不了,进阶的话,可以使用autoprefixer来处理相关的兼容性问题,但是也会为了实现flex布局而新增很多class来实现对应的布局效果,当然了,也会有人把对应的布局属性封装成class来调用,但是很容易引起class过长的问题。从执行效率上,属性匹配的方式确实是比不上直接class匹配的效率高,但是从维护的角度看,我可以从短短的flex=“main:center cross:centere” 这个字来看出html的基本布局结构,之所以采用属性匹配的方式,也仅仅是因为可以写更少的代码

from flex.css.

CandySunPlus avatar CandySunPlus commented on May 13, 2024

感觉 postcss+autoprefixer 是主流发展方向, 你这又是在 flexbox上适配出了一套体系。

from flex.css.

lzxb avatar lzxb commented on May 13, 2024

@CandySunPlus 本质上flex.css都是使用autoprefixer编译处理的,能够让你写html的时候,用最精简的代码,快速构建flex布局。

    <!-- 自己写flex布局 -->
    <style type="text/css">
        .box {
            display: flex
        }
    </style>
    <div class="box"></div>

    <!-- flex.css实现flex布局 -->
    <div flex></div>

from flex.css.

zerofront avatar zerofront commented on May 13, 2024

@lzxb 想了几天发现还是有点奇怪,违背了结构与样式分离的初衷。但是如果把这个整合成类的话,确实是类名很乱。还是觉得直接写好一些。请问autoprefixer 可以设置兼容uc吗??我作了一个demo,是按列排布的,设置了flex-flow: wrap column 后其他浏览器都可以,而在UC下无法实现父元素高度不够的时候换列。

from flex.css.

lzxb avatar lzxb commented on May 13, 2024

@zerofront 这个是无解的,因为-webkit-box不支持。其实这个并矛盾,只是将布局从css中迁移到html中,css中少了布局的代码,然而其他的还是使用css来控制元素的显示风格

from flex.css.

zerofront avatar zerofront commented on May 13, 2024

如果不能用flex-wrap的话如何解决垂直排列,但是又要在第一列装不下的时候自动换行到下一列呢?

from flex.css.

lzxb avatar lzxb commented on May 13, 2024

@zerofront 这个目前暂时没有解决方法,需要换行的,我目前也是使用浮动布局

from flex.css.

zerofront avatar zerofront commented on May 13, 2024

@lzxb 请问 浮动如何实现按列排布??https://www.zhihu.com/question/50584424?from=profile_question_card

from flex.css.

lzxb avatar lzxb commented on May 13, 2024

@zerofront 浮动布局,还是自己自己补习一下基础吧

from flex.css.

zerofront avatar zerofront commented on May 13, 2024

@lzxb 大哥,不是浮动布局不会,是浮动布局根本不能按列竖直排列下来,只能横着排~~~~~~~~~~

from flex.css.

lzxb avatar lzxb commented on May 13, 2024

@zerofront 明白了,我试试

from flex.css.

lzxb avatar lzxb commented on May 13, 2024

@zerofront 估计只能使用定位布局,使用js来动态计算了。。。

from flex.css.

evolutionjay avatar evolutionjay commented on May 13, 2024

想法挺好的。但我选择 Autoprefixer 直接 Chrome 24 配置一下完事。

from flex.css.

lzxb avatar lzxb commented on May 13, 2024

@evolutionjay 还是要看各人喜好,想怎么写就怎么写

from flex.css.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.