Viewport height minus X px

Hello Im trying to get this output for a character style

1

Im using this javascript syntax

$w.onReady( function () {

var style1 = “height:calc” + “(” + “100” + “vh” + " " + “-” + " " + “50” + “px” + “)” ;
$w( “#text1” ).html = “<” + “h1” + " style=" + style1 + “>” + $w( “#text1” ).text + “</” + “h1” + “>” ;
});

This gives me this output

1

Can anyone tell me why Im gettin the " behind vh?

I don’t know why (there’s no reason for that) but why are you writing it in such complicated way? Why won’t you just put it like:

var style1 = "height:calc(100vh - 50px)";
$w("#text1").html = `<h1 style="${style1}">${$w("#text1").text}</h1>`;

[fixed]

Hey J.D.
Thank you very much!!!

I have limited skills in coding so my code was copy/paste from the internet :S

Your code worked with one minor adjustment, just needed blank spaces on both sides of the minus symbol.

So like this it worked

var style1 = "height:calc(100vh - 50px)";
$w("#text1").html = `<h1 style="${style1}">${$w("#text1").text}</h1>`;

I used this to have strip on a page that always fills the screen height, the minus 50px is to account for the header.

Thanks again! :slight_smile: