.dcss-solve
Finds the input at which your formula reaches a target, by halving the range, as a spreadsheet’s Goal Seek does.
Example
Result
Markup
<link rel="stylesheet" href="dcss.css">
<link rel="stylesheet" href="families/format.css">
<link rel="stylesheet" href="families/math.css">
<div class="dcss-solve sq" style="--from: 0; --to: 1; --target: 50"><i><i><i><i><i><i><i><i><i><i><i><i><i>
<output class="dcss-format-fixed" style="--value: var(--dcss-solve); --precision: 3"></output></i></i></i></i></i></i></i></i></i></i></i></i></i>
</div>
CSS
.sq i { --dcss-formula: calc(100 * pow(var(--dcss-input), 2)); }
Notes
Each call takes your own formula, written once as --dcss-formula in terms of --dcss-input. A .dcss-solve with data-dcss-steps="n" halves the range n times, one nested element a step, and BASICSS writes those elements for you: npx basicss page.html -o built.html.
Browser support
| Browser | Support |
|---|---|
| Chrome | Yes |
| Safari | Yes |
| Firefox | Whole numbers only |