我在html中建立了一個<canvas>標(biāo)簽準(zhǔn)備繪制背景,后將網(wǎng)頁內(nèi)容放在一個<div>中,在之后發(fā)現(xiàn)<canvas>總是遮擋住<div>內(nèi)容,使用position:relative、z-index等屬性都沒達(dá)到預(yù)想的效果(極有可能是初學(xué)者代碼使用錯誤),請各位大神幫忙解決,以下是html和css的代碼。
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link href="css/first.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
<canvas id="one" class="one1"></canvas>
<script type="text/javascript">
var canvas=document.getElementById('one');
one.width="1440";
one.height="2000";
one.style.border="0px solid";
var ctx=one.getContext("2d");
ctx.beginPath();
ctx.moveTo(0,0);
ctx.lineTo(500,0);
ctx.lineTo(0,500);
ctx.closePath();
ctx.fillStyle = '#9aebff';
ctx.fill();
ctx.beginPath();
ctx.moveTo(1092,0);
ctx.lineTo(1440,0);
ctx.lineTo(1440,2000);
ctx.lineTo(768,2000);
ctx.closePath();
ctx.fillStyle = '#9aebff';
ctx.fill();
</script>
<div class="main">
<!-- 以下是對問題沒有影響的網(wǎng)頁內(nèi)容 -->
<div class="first">
<a href="#" class="infirst1">首頁
</a>
<a href="#" class="infirst2">版塊介紹
</a>
<a href="#" class="infirst3">各個部門
</a>
</div>
<div class="second">
各個部門
<p class="insecond2">Various departments
</p>
</div>
<div class="third">
<p class="inthird">采編部</p>
<p>對待工作認(rèn)真,踏實(shí)肯干,有團(tuán)隊(duì)合作精神</p>
<p>熱愛文學(xué)寫作、有良好的語言表達(dá)能力和溝通能力</p>
<p>對攝影、攝像感興趣(不要求較高的專業(yè)基礎(chǔ))</p>
<p>思路開闊、清晰,具有一定創(chuàng)新能力</p>
<div class="one">
</div>
</div>
<hr class="line"/>
<div class="fourth">
<p class="infourth">美編部</p>
<p>具有良好的電腦作圖能力和色彩感,并有獨(dú)特的創(chuàng)意及審美理念</p>
<p>具有良好的圖片處理能力和策劃能力</p>
<p>對PS、AI等專業(yè)軟件具有一定興趣(不要求較高的專業(yè)基礎(chǔ))</p>
<div class="two">
</div>
<div>
<hr class="line2"/>
<div class="fifth">
<p class="infourth">技術(shù)部</p>
<p>熱衷于程序、微信新功能的開發(fā),對于WEB開發(fā)有獨(dú)到見解</p>
<p>要求有較強(qiáng)的學(xué)習(xí)能力、調(diào)試能力</p>
<div class="three">
</div>
</div>
<hr class="line3"/>
<div class="sixth">
<p class="infourth">維新工作室</p>
<p>具有一定的原創(chuàng)創(chuàng)作能力,善于發(fā)現(xiàn)生活中的亮點(diǎn)</p>
<p>看待問題視角獨(dú)特,思路創(chuàng)新</p>
<div class="four">
</div>
</div>
<hr class="line3"/>
<div class="seventh">
<p class="infourth">微博工作室</p>
<p>會使用微博、人人等交際軟件</p>
<p>具有一定的互動能力、文字編寫能力和創(chuàng)新意識</p>
</div>
<div class="five">
</div>
</div>
</div>
</body>
</html>
.container{
width:1440px;
height:2000px;
margin:0 auto;
}
.bg{
width:1440px;
height:2000px;
}
.main{
width:1440px;
height:2000px;
position:relative;
top:-2000px;
z-index:20;
}
/*以下是對問題沒有影響的網(wǎng)頁內(nèi)容*/
.first{
width:544px;
height:60px;
background:#51afd9;
float:right;
margin-top:34px;
font-size:17px;
color:#3783a9;
line-height:60px;
}
.infirst1{
font-size:17px;
text-decoration:none;
font-family:"黑體";
margin-left:246px;
}
.infirst2{
font-size:17px;
text-decoration:none;
font-family:"黑體";
margin-left:30px;
}
.infirst3{
font-size:17px;
text-decoration:none;
font-family:"黑體";
margin-left:30px;
}
.infirst1:hover{
color:#ffffff;
}
.infirst2:hover{
color:#ffffff;
}
.infirst3:hover{
color:#ffffff;
}
.second{
text-align:center;
font-size:28px;
color:#255474;
font-family:"黑體";
float:left;
margin-left:495px;
margin-top:115px;
}
.third{
width:941px;
height:334px;
color:#255474;
float:left;
margin-left:250px;
font-family:"黑體";
}
.inthird{
margin-top:80px;
font-size:22px;
}
.one{
width:243px;
height:243px;
background-image:url(../images/one.png);
overflow:hidden;
border-radius:50%;
float:right;
margin-top:-210px;
}
.line{
width:906px;
height:3px;
background-color:#84bbe1;
float:left;
margin-left:250px;
}
.fourth{
width:941px;
height:334px;
color:#255474;
float:left;
margin-left:250px;
font-family:"黑體";
}
.infourth{
margin-top:80px;
font-size:22px;
}
.two{
width:243px;
height:243px;
background-image:url(../images/two.png);
overflow:hidden;
border-radius:50%;
float:right;
margin-top:-190px;
}
.line2{
width:906px;
height:3px;
background-color:#84bbe1;
float:left;
margin-top:58px;
}
.fifth{
width:941px;
height:334px;
color:#255474;
float:left;
font-family:"黑體";
}
.three{
width:243px;
height:243px;
background-image:url(../images/three.png);
overflow:hidden;
border-radius:50%;
float:right;
margin-top:-155px;
}
.line3{
width:906px;
height:3px;
background-color:#84bbe1;
float:left;
}
.sixth{
width:941px;
height:334px;
color:#255474;
float:left;
font-family:"黑體";
}
.four{
width:243px;
height:243px;
background-image:url(../images/four.png);
overflow:hidden;
border-radius:50%;
float:right;
margin-top:-155px;
}
.seventh{
width:941px;
height:334px;
color:#255474;
float:left;
font-family:"黑體";
}
.five{
width:243px;
height:243px;
background-image:url(../images/five.png);
overflow:hidden;
border-radius:50%;
float:right;
margin-top:-295px;
}
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
北大青鳥中博軟件學(xué)院創(chuàng)立于2003年,作為華東區(qū)著名互聯(lián)網(wǎng)學(xué)院和江蘇省首批服務(wù)外包人才培訓(xùn)基地,中博成功培育了近30000名軟件工程師走向高薪崗位,合作企業(yè)超4
中公教育集團(tuán)創(chuàng)建于1999年,經(jīng)過二十年潛心發(fā)展,已由一家北大畢業(yè)生自主創(chuàng)業(yè)的信息技術(shù)與教育服務(wù)機(jī)構(gòu),發(fā)展為教育服務(wù)業(yè)的綜合性企業(yè)集團(tuán),成為集合面授教學(xué)培訓(xùn)、網(wǎng)
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。