其他分享
首页 > 其他分享> > untiy WebGl 设置网页背景图片

untiy WebGl 设置网页背景图片

作者:互联网

<!DOCTYPE html>
<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <title>Unity WebGL Player | JiLin ZG</title>
    <link rel="shortcut icon" href="TemplateData/favicon.ico">
    <link rel="stylesheet" href="TemplateData/style.css">
    <script src="TemplateData/UnityProgress.js"></script>
    <script src="Build/UnityLoader.js"></script>
	<script src="../shipin.json"></script>
    <script>		
       var gameInstance = UnityLoader.instantiate("unityContainer", "Build/Touareg.json", {onProgress: UnityProgress});
      }    
    </script>
	
<style>
		    #unityContainer{
		    #!important的作用是屏蔽其他样式,只使用这个样式
			background-image:url(TemplateData/bg.gif)  !important ;  #TemplateData是index.html的同级文件夹,bg.gif需要自己创建
            background-size: 100% 100% !important;  
            background-repeat:no-repeat !important; 
		}
</style>

  </head>
  <body>
    <div class="webgl-content" style="width:100%;height:100%">
      <div id="unityContainer" style="width: 100%; height: 100%;"></div>
    </div>
  </body>
</html>

标签:TemplateData,bg,unityContainer,gif,untiy,WebGl,网页背景,important,background
来源: https://blog.csdn.net/weixin_44568736/article/details/121074647