Hack Forums
[HTML] Changing Font - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: [HTML] Changing Font (/showthread.php?tid=5735506)



[HTML] Changing Font - S U-R-O Y - Oct 12, 2017

Figured it out. Figured it out. Figured it out.


* - Nachfolger - Oct 12, 2017

Leave your question so people with the same question can search for it. It's very rude to edit it and pretend like we all didn't have to ask such a nooby question at one point. Or at least lock your thread with the question unanswered.

To answer your question (assuming, since I can't SEE IT)

CSS:
Code
.special-text {
   font-family: sans-serif;
}

HTML Inline:
Code
<div style='font-family: sans-serif'> text goes here </div>



* - Rushax - Oct 12, 2017

Why not put a way for Javascript too :D

Code
<p id="myText">This is a paragraph.</p>

<button type="button" onclick="changeFont()">Change font</button>

/open script
function changeFont() {
    document.getElementById("myText").style.fontFamily = "Arial,sans-serif";
}
/close script