Git Product home page Git Product logo

fuxingloh / css-horizontal-collapse-demo Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 1.49 MB

Chrome Fixed It. - This used to be "A demo of how CSS horizontal collapse can cause oddities in components rendered in the horizontal space."

Home Page: https://css-collapse-vue-horizontal.fuxing.dev/

Vue 77.36% JavaScript 18.86% TypeScript 3.78%
vue vuejs css lazy-loading nuxt-components horizontal-scrolling horizontal vue-horizontal

css-horizontal-collapse-demo's Introduction

CSS Horizontal Collapse Demo

CSS horizontal collapse can cause oddities in components rendered in the horizontal space. An item get collapsed when there isn't any height. <img> causes collapse too.

Why?

The short answer for this is that elements with width but without height basically equate to no width. Once the content becomes available, height will be given and therefore it start to occupy horizontal space. Images are loaded in an asynchronous fashion thus height available and factored in later. In this example, flex is used and therefore 'align-items: stretch' is the default value. Thus giving all items in the flex the same height. However, if index 3 is loaded before index 0; height will be given to index 3 first causing the scroll left position to be in a unexpected position.

Build Setup

# install dependencies
$ npm install

# serve with hot reload at localhost:3000
$ npm run dev

# build for production and launch server
$ npm run build
$ npm run start

# generate static project
$ npm run generate

Caveat

Demo examples written for vue-horizontal. Nuxt was used for this micro-site, but the principles are mostly the same for all vue or css implementation.

css-horizontal-collapse-demo's People

Contributors

fuxingloh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

seaskydl

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.