开发开⼼⽹⽹页游戏HTML+CSS代码分享
偶然间闲来⽆事,开发了⼀个开⼼⽹静态页⾯⾮常适合前端初学者拿来练⼿哦。
静态页⾯,只⽤到了HTML和CSS。
代码分享
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
li {
list-style: none;
}
header a {
text-decoration: none;
color: #ffffff;
}
a:hover {
color: blue;
}
/* 头部部分 */
header {
position: relative;
width: 1000px;
height: 50px;
border: 1px solid red;
margin: 0 auto;
background:
linear-gradient(to bottom, rgb(252, 25, 63), rgb(231, 51, 84), rgb(243, 181, 194));
border-radius: 10px;
}
/* 头部图⽚ */
header .pho {
position: absolute;
width: 247px;
height: 45px;
left: 25px;
top: 5px;
}
/* 头部⾸页⽂字 */
header .header_text {
display: inline-block;
/* border: 1px solid black; */
text-align: center;
line-height: 47px;
font-weight: 700;
color: #ffffff;
width: 121px;
height: 43px;
margin-left: 296px;
margin-top: 9px;
vertical-align: bottom;
position: relative;
}
/
*⾸页点击效果 */
header .header_text:hover {
background-color: #fff;
color: red;
font-weight: 400;
}
/* 头部导航栏 */
.header_nav {
width: 250px;
height: 18px;
line-height: 18px;
float: right;
margin-top: 17px;
margin-right: 20px;
}
/* 头部导航栏⽂字 */
.navs li {
width: 57px;
height: 16px;
float: left;
/* padding-left: 12px; */
color: #ffffff;
font-size: 14px;
text-align: center;
line-height: 16px;
}
/* 头部导航栏竖线 */
.navs li {
border-right: 1px solid #ffffff;
}
/* 最后⼀个竖线隐藏 */
.header_nav .lastnav {
border-right: 1px solid transparent;
}
/* 内容板块 */
article {
position: relative;
margin-top: 20px;
/* border: 1px solid black; */
width: 1000px;
height: 260px;
border-radius: 10px;
margin: 10px auto;
}
/
* 左边选框 */
.rightbox {
width: 180px;
height: 239px;
border: 1px solid rgb(158, 158, 158);
border-radius: 10px;
/* border: 1px solid red; */
}
article .rightbox ul a {
color: black;
}
/
* 右侧边栏li得设置 */
article .rightbox ul li {
position: relative;
width: 180px;
height: 35px;
/* border: 1px solid blue; */
background-image: url(../material/制作开⼼⽹页游戏/images/游戏列表灰⾊渐变.jpg);
background-repeat: no-repeat;
background-position: -10px 0;
transition: all .1s;
}
article .rightbox ul li:hover {
background-image: url(../material/制作开⼼⽹页游戏/images/游戏列表⿏标移⼊的渐变.jpg);    }
/*第⼀个和最后⼀个li的边⾓设置 */
.first {
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.last {
border-bottom-left-radius: 21px;
border-bottom-right-radius: 21px;
}
/
* ⼩图标设置 */
.icon {
position: absolute;
left: 5px;
top: 8px;
line-height: 32px;
font-size: 14px;
}
/* 导航栏⽂字设置 */
.rightbox .uls li span {
position: absolute;
left: 37px;
font-size: 14px;
line-height: 35px;
}
/* 中间背景 */
.middlebox {
position: absolute;
left: 210px;
top: 7px;
width: 510px;
height: 220px;
/
* border: 1px solid red; */
background-image: url(../material/制作开⼼⽹页游戏/images/xdtgg_frxz2_44.jpg);        background-repeat: no-repeat;
background-size: 100% 100%;
border-radius: 12px;
}
/* 轮播按钮框 */
.pointer {
position: absolute;
bottom: 10px;
right: 10px;
width: 150px;
height: 25px;
/* border: 1px solid red; */
}
/* 轮播按钮 */
.middlebox .pointer li {
float: left;
margin-left: 10px;
border-radius: 50%;
background-color: #cfcac0;
width: 20px;
height: 20px;
/
* border: 1px solid black; */
text-align: center;
line-height: 20px;
}
.middlebox .pointer li:first-of-type {
color: #fff;
background-color: #c72a19;
}
/* 轮播按钮点击效果 */
.middlebox .pointer li:hover {
color: #fff;
background-color: #c72a19;
}
.inputs {
position: absolute;
right: 0px;
top: 0px;
width: 243px;
height: 238px;
border-radius: 10px;
border: 1px solid rgb(234, 234, 234);
background-color: #fafafa;
}
/* 登录标题 */
.inputs h4 {
position: absolute;
left: 15px;
top: 15px;
font-weight: 400;
color: #4b4b4b;
}
/* 账号框 */
.inputs .entry {
position: absolute;
top: 70px;
left: 14px;
width: 200px;
height: 23px;
/* border: 1px solid red; */
}
.inputs .entry .entryname {
width: 50px;
height: 25px;
line-height: 25px;
font-size: 16px;
/* border: 1px solid blue; */
}
.inputs .entry .entrykuang input {
position: absolute;
right: -2px;
top: 1px;
width: 150px;
height: 20px;
/* border: 1px solid black; */
font-size: 10px;
color: rgb(143, 143, 143);
line-height: 20px;
text-indent: 1em;
}
.psw {
position: absolute;
left: 14px;
top: 117px;
width: 200px;
height: 23px;
/* border: 1px solid red; */
}
.entrypsw {
width: 50px;
height: 25px;
line-height: 25px;
font-size: 16px;
}
.pswkuang input {
position: absolute;
right: -2px;
top: 0px;
width: 150px;
height: 20px;
/* border: 1px solid black; */
font-size: 10px;
color: rgb(143, 143, 143);
line-height: 20px;
text-indent: 1em;
bottom: 50px;
width: 75px;
height: 25px;
border: 1px solid #db2c35;
}
.buttonbg {
width: 73px;
height: 23px;
background-color: #db2c35;
margin: 1px 1px;
color: #fff;
text-align: center;
line-height: 23px;
}
.entrybottom {
position: absolute;
left: 37px;
bottom: 12px;
width: 170px;
height: 25px;
/* border: 1px solid red; */
}
.entrybottom .lijizhuce {
float: left;
width: 64px;
height: 25px;
color: #65768a;
/* border: 1px solid blue; */
}
.inputs a {
text-decoration: none;
}
.entrybottom .wangjimima {
float: right;
width: 64px;
height: 25px;
/* border: 1px solid blue; */
}
/* 全部游戏界⾯ */
.allgame {
position: relative;
width: 719px;
height: 250px;
border: 1px solid rgb(215, 215, 215);
margin-top: 23px;
border-radius: 10px;
}
/* 游戏板块标题背景 */
.
gametitle {
width: 717px;
height: 35px;
border: 1px solid transparent;
margin-top: 0px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
background:
linear-gradient(to bottom, rgb(247, 247, 248), rgb(245, 244, 244), rgb(241, 242, 241));    }
/* 游戏板块li制作 */
.allgame .gametitle ul {
width: 350px;
height: 20px;
/* border: 1px solid black; */
margin-top: 7px;
}
/*全部游戏板块 li制作 */
.allgame .gametitle ul li {
float: left;
width: 85px;
height: 20px;
border-right: 1px solid rgb(142, 151, 161);
font-size: 10px;
color: rgb(142, 151, 161);
text-align: center;
line-height: 20px;
}
/*游戏板块第⼀个li设置 */
article .allgame .gametitle ul li:first-child {
color: red;
font-weight: 700;
border-right: 1px solid transparent;
}
/
*游戏板块第⼀个li设置 */
article .allgame .gametitle ul li a {
text-decoration: none;
color: rgb(157, 86, 96);
}
/*游戏板块第⼀个li设置 */
article .allgame .gametitle ul li a:hover {
background-color: skyblue;
}
/*游戏板块最后⼀个li设置 */
article .allgame .gametitle ul li:last-child {
border-right: 1px solid transparent;
}
/* 游戏介绍模块 */
.introdution1 {
width: 325px;
height: 165px;
border: 2px solid rgb(234, 234, 234);
border-radius: 10px;
position: absolute;
left: 25px;
top: 325px;
}
.introdution2 {
width: 325px;
height: 165px;
border: 2px solid rgb(234, 234, 234);
border-radius: 10px;
position: absolute;
right: 305px;
top: 325px;
}
/* 游戏模块图⽚ */
.
introdution1 img {
width: 155px;
margin-left: 10px;
margin-top: 26px;
transition: all 1s;
}
/* 图⽚过渡动画 */
.introdution1:hover img {
transform: translateX(-10px);
}
/* 游戏模块⽂字 */
.
introdution1 .introdutiontext {
position: absolute;
top: 21px;
right: 1px;
width: 150px;
height: 90px;
/* border: 1px red solid; */
}
.introdution1 .introdutiontext p {
font-size: 5px;
line-height: 22px;
font-weight: 700px;
}
.introdution1 .introdutiontext p span {
color: rgb(172, 13, 13);
}
.introdution1 .introdutiontext .button1 {
width: 48px;
height: 20px;
margin-top: 5px;
background-color: rgb(255, 255, 255);
border: 1px solid rgb(191, 192, 192);
border-radius: 3px;
color: rgb(82, 80, 79);
font-size: 10px;
line-height: 19px;
text-align: center;
}
.introdution1 .introdutiontext .button2 {
width: 65px;
height: 20px;
margin-top: 5px;
background:
linear-gradient(to bottom, rgb(123, 192, 210), rgb(55, 108, 156));        border: 1px solid rgb(191, 192, 192);
border-radius: 3px;
color: #fff;
font-size: 10px;
line-height: 19px;
text-align: center;
}
/* 游戏模块图⽚ */
.introdution2 img {
width: 155px;
网页float是什么意思margin-left: 10px;
margin-top: 26px;
transition: all .5s;
}
/* 图⽚过渡动画 */
.introdution2 img:hover {
transform: translateX(-10px);
}
.introdution1 .photo1 {
width: 155px;
margin-left: 10px;
margin-top: 26px;
transition: all .5s;
}
.introdution1:hover .photo1 {
transform: translateX(-10px);
}
/* 游戏模块⽂字 */
.introdution2 .introdution2text {
position: absolute;
top: 21px;
right: 1px;
width: 150px;
height: 90px;
/* border: 1px red solid; */
}
.introdution2 .introdution2text p {
font-size: 10px;
line-height: 22px;
font-weight: 700px;
}
.introdution2 .introdution2text p span {
color: rgb(172, 13, 13);
}
.
introdution2 .introdution2text .button3 {
width: 48px;
height: 20px;
margin-top: 5px;
background-color: rgb(255, 255, 255);

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。