所以画布,我有一个JS画布产生我的BG和导航栏结束了,但问题是,我把任何对话框出现在背景上。 我希望即使在导航下也能随时看到圈子。 简单的英语 - 我想让所有的盒子背景透明。 我希望问题很清楚。
代码:
HTML:
<html>
<head>
<meta charset="utf-8">
<title>Sky</title>
<!-- Styles -->
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link href="css/header.css" rel="stylesheet" type="text/css"/>
<link href="css/content.css" rel="stylesheet" type="text/css"/>
<link href="css/footer.css" rel="stylesheet" type="text/css"/>
<!-- P5 Libraries -->
<script language="javascript" type="text/javascript" src="libs/p5.js"></script>
<script language="javascript" src="libs/p5.dom.js"></script>
<!-- Sky BG -->
<script language="javascript" type="text/javascript" src="js/sketch.js"></script>
<script language="javascript" type="text/javascript" src="js/star.js"></script>
</head>
<body>
<div id="mainWrap">
<header>
<div id="logoDiv">
</div>
<nav id="mainNav">
<ul>
<li><a href="">HOME</a></li>
<li><a href="">ABOUT</a></li>
<li><a href="">HELP</a></li>
<li><a href="">CONTACT</a></li>
</ul>
</nav>
</header>
</div>
</body>
</html>
CSS:
html, body, #mainWrap {
height:100%;
width:100%;
margin:0px;
}
body{
color: rgba(255,255,255,0.9);
background-color: #222222;
}
a {
text-decoration: none;
color: rgba(255,255,255,0.3);
}
ul {
list-style-type:none;
}
CSS标题:
#mainNav ul, #mainNav ul li {
margin: 0px;
padding: 0px;
}
#mainNav{
text-align: center;
width: 100%;
height: 40px;
margin: 30px auto;
background-color: rgba(255, 0, 0, 0.0);
}
#mainNav ul li{
display: inline-block;
width: 20%;
height: 100%;
text-align: center;
}
#mainNav ul li a {
display: inline-block;
vertical-align: middle;
transition: 0.5s ease-in-out;
width: 100%;
height:40px;
padding: 20px 0;
}
#mainNav ul li a:hover {
color: rgba(255,255,255,0.9);
background-color: rgba(255,255,255,0.3);
}
#logoDiv {
width: 100%;
height: 100px;
opacity: 0;
}
相关JS:
function setup() {
//full screen setup
canvas = createCanvas(window.innerWidth*1.4,window.innerHeight*1.4);
canStyle = canvas.style;
canvas.elt.style.position = "fixed";
mainWrap = document.getElementById('mainWrap');
canvas.parent(mainWrap);
不透明度:0; 或/和filter:alpha(opacity = 0);结果是...盒子元素是白色不透明的。
可能重复[如何使背景DIV只透明使用CSS](http://stackoverflow.com/questions/7565384/how-to-make-the -background-div-only-transparent-using-css) –
你可能想给我们看一个工作片断,因为这个CSS对我来说似乎很好。 – Randy
@Randy添加了一个片段! –