Html
    Css
    Js

    
                        
* {
	padding:0;
	margin:0;
	font-family:'Itim',cursive;
}
html,body {
	background-color:#cb4042;
	width:100%;
	height:96%;
	background-position:fixed;
}
h1 {
	text-align:center;
	color:#fff;
	font-size:2em;
	margin-top:3%;
}
.main {
	width:486px;
	height:486px;
	margin:auto;
	margin-top:3%;
	background-color:#fff;
	text-align:center;
	z-index:5;
}
.tic {
	display:inline-block;
	width:160px;
	height:160px;
	font-size:1em;
	-webkit-text-size-adjust:100%;
	border:1px solid #cb4042;
	cursor:pointer;
	float:left;
	color:#000;
	position:relative;
}
.tic-span {
	font-size:3em;
	color:#cb4042;
	position:absolute;
	top:50%;
	left:50%;
	transform:translate(-50%,-50%);
}
.back {
	position:fixed;
	top:0;
	width:100%;
	height:100%;
	background-color:#000;
	opacity:.5;
	z-index:20;
}
.choose {
	z-index:21;
	position:absolute;
	top:20%;
	left:0;
	right:0;
	margin:auto;
	width:700px;
	color:#fff;
	background-color:#db4d6d;
	border-radius:10px;
	outline:none;
	display:none;
}
.choose-title {
	padding-top:20px;
	text-align:center;
}
.choose-bt {
	margin-top:20px;
	margin-bottom:15px;
	/* text-align:right;
	margin-right:15px;
	*/
    text-align:center;
}
.choose-bt button {
	font-family:sans-serif;
	width:40px;
	height:40px;
	font-size:1.5em;
	text-align:center;
	background:#eee;
	border:1px solid #cb4042;
	border-radius:50%;
	outline:none;
	color:#cb4042;
	margin-left:50px;
	margin-right:50px;
	cursor:pointer;
}
.choose-bt button:hover {
	background-color:#fff;
}
.loser {
	position:absolute;
	top:0;
	height:100%;
	width:100%;
	text-align:center;
	font-size:25em;
	z-index:1;
	color:red;
	display:none;
}

                        
↑上面代码改变,会自动显示代码结果 jQuery调用版本:1.8.3
 立即下载

JS井字棋游戏

电脑先落字,然后根据人的落字位置再落字,若是人有失误就会输掉游戏。

0