Shoxrux,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style type="text/css">
#header{
font-size: var(--s, 24px);
}
</style>
</head>
<body>
<p id="header">hello world</p>
<button id="plus" data-up-font="2">plus</button>
<button id="minus" data-up-font="-2">minus</button>
<script>document.addEventListener( "DOMContentLoaded" , function() {
const on = (parent, event, selector, handler) => parent.addEventListener(event, ({target}) => {
if(target = target.closest(selector)) handler(target)
})
const header = document.querySelector("#header");
const fn = ({dataset : {upFont : up}}) => {
let s = parseInt(header.style.getPropertyValue("--s")||24);
s = Math.min(40, Math.max(24, s + +up));
header.style.setProperty("--s", `${s}px`);
}
on(document, "click", "[data-up-font]", fn);
});</script>
</body>
</html>