Code Monkey home page Code Monkey logo

css-media-vars's Introduction

James0x57

PropJockey

not yet ready for use

css-media-vars's People

Contributors

janeori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

css-media-vars's Issues

idea: variables like `--media-gt-sm`

I noticed there are no --media-lt-* or --media-gt-* variables. I think those would be useful.

F.e. instead of

.foo {
	--layout-mobile: var(--media-lte-sm) column;
	--layout-desktop: var(--media-md-lg, var(--media-xl)) row; /* not sure I did it right, but there isn't a variable that includes everything including anything gte xl, so this is complicated */
}

we could write

.foo {
	--layout-mobile: var(--media-lte-sm) column;
	--layout-desktop: var(--media-gt-sm) row;
}

We can't use --media-gte-sm because then it overlaps, whereas we want a non-overlapping distinction.

In the first example, I don't think var(--media-md-lg, var(--media-xl)) row even works, because then the final result is always initial, right? So with the lack of the -gt- and -lt- variables, a casual CSS user might not know exactly how to achieve that.

Is there a way to make this example more concise?

First of all, this is amazing! It is super useful!!

I have the following, which works:

@import 'https://unpkg.com/[email protected]/css-media-vars.css';

.face_container {
	--margin-left-mobile: var(--media-xs) 0;
	--margin-left-desktop: var(--media-lte-sm) 20px;
	--margin-top-mobile: var(--media-xs) 20px;
	--margin-top-desktop: var(--media-lte-sm) 0;
	margin-left: var(--margin-left-mobile, var(--margin-left-desktop));
	margin-top: var(--margin-top-mobile, var(--margin-top-desktop));
}

Is there a more concise way to write it?

I guess maybe another question is can we make the equivalent of a NOT operator, and flip the mobile-desktop values, instead of writing two new variables, or something?

Based on your circuit example with the number display, I think the answer is we can. The syntax just isn't fully clear to a casual CSS user like me. :)

Explanation of syntax

I think that it'd be beneficial to explain the syntax with a couple of sentences. For example, I quickly checked the documentation to see what --var2: var(--var1) value does, but couldn't find anything. It looks like a ternary?

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.