1.1小米手机页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.goods {
width: 200px;
height: 300px;
background-color: darkgrey;
text-align: center;
}
.good img {
width: 160px;
height: 160px;
}
.good h5{
font:14px;
font-weight: 400;
}
.goods p{
font-size: 12px;
color:rgb(46, 43, 43), 245, 245);
}
.goods span:nth-of-type(1){
font-size: 12px;
color:peru;
text-decoration: line-through;
}
</style>
</head>
<body>
<div class="goods">
<img src="../images/shouji.gpg.jpg"
<h5> Redmi Note 12T Pro</h5>
<p>年度最眩led屏幕之光</p>
<span>1499元起</span> <span>1599元起</span>
</div>
</div>
</body>
</html>
结果:
1.2 用for循环做九九乘法表
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
span{
display: inline-block;
margin: 15px;
}
</style>
</head>
<body>
<script>
// for(let i=1; i < 8; i++){
// console.log(`今天是第${i}天`)
// for(let j = 1; j < 11; j++){
// console.log(`这是今天第${j}朵花`)
// }
// }
for(let i = 1; i < 10; i++){
for(let j = 1; j <= i; j++){
document.write(`<span>${j}*${i}=${i*j}</span>`);
}
document.write(`<br/>`)
}
</script>
</body>
</html>
1.3用while循环做九九乘法表
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
span{
display: 0 auto;
margin: 15px;
}
</style>
</head>
<body>
<script>
let i = 1
while( i <= 9){
let j = 1
while(j <= i){
document.write(`<span>${j}*${i}=${i*j}</span>`);
j++
}document.write(`<br/>`)
i++
}
</script>
</body>
</html>
结果:
1.4 五彩导航中添加定位
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>五彩导航</title>
<style>
a{
display: inline-block;
text-decoration: none;
width: 120px;
height: 58px;
text-align: center;
line-height: 54px;
color: #3f3f3f;
}
.one{
background-image: url(../images/bg1.png);
}
.two{
background-image: url(../images/bg2.png);
}
.three{
position:relative;
background-image: url(../images/bg3.png);
}
.four{
background-image: url(../images/bg4.png);
}
.three img{
display: none;
position:absolute;
bottom: -130px;
/* 让与第三个导航的左边对齐 */
left: 0;
}
.one:hover{
background-image: url(../images/bg5.png);
color: white;
}
.two:hover {
background-image: url(../images/bg6.png);
color: white;
}
.three:hover {
background-image: url(../images/bg7.png);
color: white;
}
.three:hover img {
display: block;
}
.four:hover {
background-image: url(../images/bg8.png);
color: white;
}
</style>
</head>
<body>
<a href="#" class="one">五彩导航</a>
<a href="#" class="two">五彩导航</a>
<a href="#" class="three">
五彩导航
<img src="../images/code.jpg" alt="">
</a>
<a href="#" class="four">五彩导航</a>
</body>
</html>
结果: