Adding CSS font to website

I want to add a font to my website that I can access exclusively with a CSS stylesheet link. I’ve pasted the code that I have access to.

To be pasted into an HTML header:

To be added to CSS:
.titlinggothicfbextendedmedium {
font-family: “Titling Gothic FB Extd Med”;
font-style: Normal;
font-weight: Normal;
}

I’m not well versed in code and am not sure if there is something obvious I am missing for how to do this.

I tried the following code to add the stylesheet to the site and assign the font to a specific element.

$w.onReady(function addCss(TitlingGothic) {

var head = document.head;
var link = document.createElement(“”);

link.type = “text/css”;
link.rel = “stylesheet”;
link.href = TitlingGothic;

head.appendChild(link);
}

addCss(‘{l}’);

$w(“#text2”).html = <span style="font-family:"Titling Gothic FB Extd Med">${$w("#text2").text}</span>;
});

Please let me know if you have any information for me!

Hi Sarah,

You can’t just embed HTML/CSS/Javascript into a page. WixCode understands all of Javascript, except for anything that accesses the DOM. This keeps the user from inadvertently “breaking” something. I myself tried to hack things from the code, from an iFrame, and in my dreams, but WixCode wasn’t having any of it.

Accessing document elements such as div, span, button, etc is off-limits. The way to access elements on the page is only through $w.

One small exception is the $w.HtmlComponent , which won’t solve your problem however . This element was designed to contain vanilla HTML and it works just fine. However, you just can’t try to trick it by using parent, window, top, etc. For more information, see the article Working with the HTML Component in Wix Code .

Yisrael

Thanks for your response! That makes sense. Is there any other conceivable way to add this font, then?