GithubHelp home page GithubHelp logo

wildhoney / regrowth Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 106 KB

🔬Regrowth is a monstrous laboratory experiment in container queries brought to life.

Home Page: https://regrowth.herokuapp.com/

License: MIT License

CSS 7.29% HTML 20.20% JavaScript 72.51%
container-queries container-query element-queries element-query modular responsive component element

regrowth's Introduction

Regrowth

🔬 Regrowth is a monstrous laboratory experiment in container queries brought to life.


  • Parses all link elements and extracts all relevant @media rules.
  • Listens for dynamically added stylesheets using MutationObserver.
  • Parses the related CSS rules using the browser's internal CSS AST.
  • Inserts iframe elements relative to each matching selector.
  • Attaches resize events on the aformentioned iframe elements.
  • Updates stylesheets accordingly using matchMedia on resize.

Getting Started

You use the familiar @media rules in your CSS stylesheet – the only difference is that to make a rule a container query rule, you need to append container as a media rule.

@media container and (max-width: 256px) {
    my-element {
        background-color: orange;
    }
}

Removing the container rule will make the @media rule a normal CSS media rule relative to the window's dimensions, as opposed to the element's dimensions. Although we could allow the container to be specified anywhere with ease, it's required to be the first rule to make it obvious that the @media rule is not a regular media query.

In the above example the my-element rule will apply to all nested selectors when screen and (max-width: 256px) is applicable to the element.

regrowth's People

Contributors

wildhoney avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.