Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div var-component>
    no input
    <div var-component style="--smaller-input: 7px">
      smaller input
    </div>
    <div var-component style="--bigger-input: 7px;">
      bigger input
      <div var-component style="--smaller-input: 7px">
        smaller input
      </div>
    </div>
  </div>
</body>
</html>
 
@property --bigger { syntax: "*"; inherits: false; }
@property --smaller { syntax: "*"; inherits: false; }
[var-component] {
  --bigger-input: initial;
  --smaller-input: initial;
  /* since --bigger is a computed value,
     nothing inheriting can skip it once it's been used
     without knowledge of the internal variables for the
     component
  */
  --bigger: calc(var(--bigger-input) * 5);
  --smaller: calc(var(--smaller-input) / 2);
  font-size: var(--bigger, var(--smaller, 12px));
  border: var(--bigger, var(--smaller, 2px)) solid black;
  padding: var(--bigger, var(--smaller, 5px));
  margin: var(--bigger, var(--smaller, 5px));
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers