.dcss-solve-newton
Finds a root of your formula with Newton’s method, from its slope.
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 dcss-solve-newton nw" style="--from: 0; --to: 2"><i><i><i><i><i><i>
<output class="dcss-format-fixed" style="--value: var(--dcss-solve); --precision: 4"></output></i></i></i></i></i></i>
</div>
CSS
.nw i { --dcss-formula: calc(var(--dcss-input) * var(--dcss-input) - 2); --dcss-slope: calc(2 * var(--dcss-input)); }
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 |