Drop shadow on text using .html

Hey all,

What’s the best way to add a drop shadow using Velo on EditorX? Right now I have this:

$w("#text3").html = "<p style='word-spacing: 4px;filter: drop-shadow(1px 1px 5px #000000)'>TEXT</p>"

Which works, but when I try this…

$w("#text3").html = "<p style='word-spacing: 4px;filter: drop-shadow(1px 1px 5px #000000)'>${​​​​​​​​​$w("#text3").text}</p>";

It doesn’t work, any idea why? I’d like to just use the #text3 variable rather than writing the text out in the .js

Thanks!

  • Chris

You are looking for —> “text-shadow”?

$w("#text3").html ="<p style='word-spacing: 4px;filter: text-shadow(1px 1px 5px #000000)'>${​​​​​​​​​$w("#text3").text}</p>";

Thanks, I’m getting an error saying it’s


missing a semicolon.

@anenga
I copy and pasted your starting CODE → You have an SYNTAX-ERROR…

$w("#text3").html ="<p style='word-spacing: 4px;filter: text-shadow(1px 1px 5px #000000)'>${​​​​​​​​​$w("#text3").text}</p>";

Take a look onto this working example! Pay ATTENTION onto the right SYNTAX!

$w('#myTextElementIDhere').html=`<b><p style="color:white; text-align:center; font-size:11px">Installed</p></b>`; 

Hi there …

The problem here is the quotations, he’s inserting a value as a regular text, it’s an undefined inline attribute, therefore an error will always occur.

When you want to insert an inline value, use the (``) quotations instead of (’ ') or (" ").

Try this instead:

$w("#text3").html = `<p style='word-spacing: 4px;filter: text-shadow(1px 1px 5px #000000)'>${​​​​​​​​​$w("#text3").text}</p>`;

Let me know if this helped.

Thanks, I now get this error:

Appreciate the help!

@anenga try

$w("#text3").html =`<p style='word-spacing:4px;filter:text-shadow(1px 1px 5px #000000)'>` + ​​​​​​​​​$w("#text3").text + `</p>`;

Answered this on SO a while ago: css - How To Add Drop Shadow in Wix Editor X - Stack Overflow