• DHTML - Relative path for custom css files and fonts ?
    3 replies, posted
Hey, I tried to make a GUI with the DHTML Panel and this worked just fine. Now I want to include my own icon Font in this DHTML Panel. References : We Love Icon Fonts but with local files. The Problem is I can't integrate my own css file (with @font-face inside) into the panel. Like <link href="/resource/style.css"> does not work. It only works when I exclude the file to a web server but i dont want to host this file outside my project structure. Also: Is it even possible to define paths inside an DHTML Tag? Thanks in advance...
Hey, if i'm understanding you right, you want to load HTML CSS, and possibly javascript files into a DHTML element? example.html <!DOCTYPE html> <html>   <head> <link rel="stylesheet" type="text/css" href="example_css.css">     <meta charset="UTF-8">     <title>Example</title>   </head>   <body> <h1 class="header">Example</h1> <script defer src="example_js.js"></script>   </body> </html> example_css.css .header { font-family: Impact; } example_js.js (sucks balls you can't use ES6) var hEle = document.getElementsByClassName("header")[0]; var text = "EXAMPLE!"; var i = 0; var newText = "" setInterval(function() { if (i >= 8) { newText = ""; i = 0; } newText +=  text[i] hEle.innerText = newText i++; }, 500) example_lua.lua local Frame = vgui.Create( "DFrame" ) Frame:SetPos( 5, 5 ) Frame:SetSize( 300, 150 ) Frame:SetTitle( "Name window" ) Frame:SetVisible( true ) Frame:SetDraggable( false ) Frame:ShowCloseButton( true ) Frame:MakePopup() html = vgui.Create("DHTML", Frame) html:Dock(FILL) html:OpenURL("asset://garrysmod/lua/example/example.html")
First of thanks for responding! The key to my problem was this line : asset://garrysmod/lua/example/example.html It seems that can only define external files with the asset: tag. Now it works perfectly, thanks for the help and have a great christmas!
No problem, hope you had a good christmas
Sorry, you need to Log In to post a reply to this thread.