练习了布局噢~

 布局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>
    *{
        margin:0;
        padding:0;
        margin:0 auto;
        color:white;
        text-align:center;
        font-size: 20px;
        font-weight: bold;
       
    }
    .main{
        width:80%;
        height:670px;
        background-color: coral;
        
    }
    .header{
        height:80px;
        line-height: 80px;
        margin-top:10px;
        background-color:lightcoral; 
        

    }
    .center{
        height:450px;
        width:90%;
        margin-top:15px;
    }
    .center-left{
        width:49%;
        background-color: cornflowerblue;
        height:450px;
        line-height: 450px;
        float:left;
        
    }
    .center-right{
        width:49%;
        background-color: cornflowerblue;
        height:450px;
        line-height: 450px;
        float:right;
    }
    .footer{
        background-color: aquamarine;
        height:60px;
        line-height: 60px;
        margin-top: 15px;
    }
    
    </style>
</head>
<body>
    <div class="main">
        <div class="header">header</div>
        <div class="center">
            <div class="center-left">center-left</div>
            <div class="center-right">center-right</div>
        </div>
        <div class="footer">footer</div>
    </div>
    
</body>
</html>

布局2

效果图:

<!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>
    *{
        margin:0;
        padding:0;
        margin:0 auto;
        color:white;
        text-align:center;
        font-size: 20px;
        font-weight: bold;
       
    }
    .main{
        width:80%;
        height:670px;
        background-color: coral;
        
    }
    .header{
        height:80px;
        line-height: 80px;
        margin-top:10px;
        background-color:lightcoral; 
        

    }
    .center{
        height:450px;
        width:90%;
        margin-top:15px;
    }
    .center-left{
        width:25%;
        background-color: cornflowerblue;
        height:450px;
        line-height: 450px;
        float:left;
        
    }
    .center-right{
        width:73%;
        background-color: cornflowerblue;
        height:450px;
        line-height: 450px;
        float:right;
    }
    .footer{
        background-color: aquamarine;
        height:60px;
        line-height: 60px;
        margin-top: 15px;
    }
    
    </style>
</head>
<body>
    <div class="main">
        <div class="header">header</div>
        <div class="center">
            <div class="center-left">center-left</div>
            <div class="center-right">center-right</div>
        </div>
        <div class="footer">footer</div>
    </div>
    
</body>
</html>

布局3

效果图:

<!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>
    *{
			text-align: center;
			color:white;
			font-weight:border;
			font-size: 25px;
			padding:5px;
            margin:0;
		}
		.main{
			background-color:#fb6;
			width:1500px;
			height:700px;
			margin-top:3px;
			}
		.header{
			height:90px;
			background-color: #fcc;
			line-height:90px;
			margin-top:20px;
			}

		.center-left{
			height:400px;
			width:23%;
			background-color:#cef;
			float:left;
			line-height: 400px;
			margin-top:20px;
		}
		.center-left::after{
			content:"";
			clear:both;
			display:block;
		}
		.center-center{
			height:400px;
			width:50%;
			background-color:#7df;
			overflow:hidden;
			line-height: 400px;
			margin-top:20px;
			display:inline-block;
		}
		.center-right{
			height:400px;
			width:23%;
			background-color:#cef;
			float:right;
			line-height: 400px;
			margin-top:20px;
			}
		.center-right::after{
			content:"";
			clear:both;
			display:block;
		}
		
		.footer{
			height:80px;
			width:1490px;
			background-color:#fd7;
			float:left;
			display:inline-block;
			line-height: 80px;
			margin-top:20px;
		}
	</style>
</head>
<body>
    <div class="main">
        <div class="header">header</div>
        <div class="center">
            <div class="center-left">center-left</div>
            <div class="center-right">center-right</div>
            <div class="center-center">center-center</div>
        </div>
        <div class="footer">footer</div>

    </div>
    
</body>
</html>

布局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>Document</title>
    <style>
        *{
            margin:0;
			color:white;
			font-weight:border;
			font-size: 25px;
			padding:5px;
			text-align: center;
		}
		.main{
			background-color:#fb6;
			width:1500px;
			height:700px;
			margin-top:3px;
			}
		.header{
			height:auto;
			background-color: #fcc;
			line-height:90px;
			margin-top:20px;
			
			}

		.center-left{
			height:auto;
			width:23%;
			background-color:#cef;
			float:left;
			margin-top:20px;
		}
		.center-left::after{
			content:"";
			clear:both;
			display:block;
		}
		.center-center{
			height:auto;
			width:50%;
			background-color:#7df;
			overflow:hidden;
			margin-top:20px;
			display:inline-block;
		}
		.center-right{
			height:auto;
			width:23%;
			background-color:#cef;
			float:right;
			margin-top:20px;
			}
		.center-right::after{
			content:"";
			clear:both;
			display:block;
		}
		
		.footer{
			height:80px;
			width:1490px;
			background-color:#fd7;
			float:left;
			display:inline-block;
			line-height: 80px;
			margin-top:295px;
		}

    </style>
</head>
<body>
    <div class="main">
        <div class="header">header</div>
        <div class="center">
            <div class="center-left">center-left <br>我是自适应的1</div>
            <div class="center-right">center-right <br>我是自适应的2 <br> 我是自适应的2</div>
            <div class="center-center">center-center <br>我是自适应的3 <br>我是自适应的3 <br>我是自适应的3</div>
        </div>
        <div class="footer">footer</div>


    </div>
    
</body>
</html>

布局5

效果如图:

<!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>
    *{
        margin:0;
        padding:0;
        margin:0 auto;
        color:white;
        text-align:center;
        font-size: 20px;
        font-weight: bold;
       
    }
    .main{
        width:80%;
        height:670px;
        background-color: coral;    
    }
    .header{
        height:80px;
        line-height: 80px;
        margin-top:10px;
        background-color:lightcoral; 
    }
    .center{
        height:450px;
        width:90%;
        margin-top:15px;
    }
    .center-left{
        width:45%;
        background-color: cornflowerblue;
        height:450px;
        float:left;
        padding:20px;
        
    }
    .center-right{
        width:45%;
        background-color: cornflowerblue;
        height:450px;
        padding:20px;
        float:right;
        
    }
    .footer{
        background-color: aquamarine;
        height:60px;
        line-height: 60px;
        margin-top: 50px;
     
    }
    .title{
        color:white;
        font-size: 25px;
        font-weight: bolder;
    }
    /* .header-word{
        font-size: 20px;
        color: white;
        font-weight: bold; */
    }
    .word{
        color:white;
        font-size: 18px;
    }
    img{
        width:180px;
        height:180px;
        border-radius: 50%;
    }
    
    </style>
</head>
<body>
    <div class="main">
        <div class="header">
            <div class="title">那些年————我追过的动画片</div>
        </div>
        <div class="center">
            <div class="center-left">
                <div class="picture"><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1576337954356&di=a1ad90283156c74a965d4d84d0287a1e&imgtype=0&src=http%3A%2F%2Fimg.tukexw.com%2Fimg%2Ff1ac9488da3fee92.jpg" alt=""></div>
                <div class="title">Tom and Jerry</div>
                <div class="word">猫和老鼠吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦</div>
            </div>
            <div class="center-right">
                <div class="picture"><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1576338094150&di=9db359126e532f8a39dd5d5f2c9a2955&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201406%2F24%2F20140624170857_yf52v.jpeg" alt=""></div>
                <div class="title">蜡笔小新</div>
                <div class="word">蜡笔小新吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦</div>
            </div>
        </div>
        <div class="footer">footer</div>
    </div>
    
</body>
</html>

布局6

效果如图:

<!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>
        *{
			padding:5px;
            margin:0;
           
		}
		.main{
			margin: 0 auto;
			width:80%;
			height:700px;
			margin-top:3px;
            border:1px solid black;
            background-color:lightgray;
			}
		.header{
			height:90px;
			text-align: center;
			line-height:90px;
			margin-top:20px;
            font-size: 40px;
            font-weight: bolder;
            border:1px solid black;
			}

		.center-left{
			height:400px;
			width:23%;
			border:1px solid black;
			float:left;
			margin-top:20px;
            display:inline-block;
            text-align: center;
		}
		.center-left::after{
			content:"";
			clear:both;
			display:block;
		}
		.center-center{
			height:400px;
			width:50%;
			border:1px solid black;
			overflow:hidden;
            margin:20px 5px;
			display:inline-block;
            text-align: center;
		}

		.center-right{
			height:400px;
			width:23%;
			border:1px solid black;
			float:right;
			margin-top:20px;
            display:inline-block;
            text-align: center;
			}
		.center-right::after{
			content:"";
			clear:both;
			display:block;
		}
		
		.footer{
			height:80px;
			width:98%;
			text-align: center;
			display:inline-block;
			line-height: 80px;
			margin-top:20px;
            font-size: 30px;
            border:1px solid black;
		}
        .picture{
            height:350px;
			
        }
        h2{
            margin:0 auto;
        }
	</style>
</head>
<body>
    <div class="main">
        <div class="header">岁寒三友————松竹梅</div>
        <div class="center">
            <div class="center-left">
                <h2>墨松</h2>
                <img class="picture" src="https://p2.ssl.qhimgs1.com/sdr/400__/t014f3332c7f540ccb2.jpg" alt="">
            </div>
            <div class="center-right">
                <h2>墨梅</h2>
                <img class="picture" src="http://file7.gucn.com/file/CurioPicfile/20130724/GucnP_U68615T031514901374658158852.jpg" alt="">
            </div>
            <div class="center-center">
                <h2>墨竹</h2>
                <img class="picture"  src="http://www.sh1122.com/upimg/2018/0328/66512_0_1522209638.jpg" alt="">
            </div>
        </div>
        <div class="footer">footer</div>

    </div>
    
</body>
</html>

再补充一个知识点:

calc的用法:
.element{
        width:calc(expression);
   }
其中,expression是一个用来计算长度的表达式,支持“+”,“-”,“*”,“/”运算符。
特别声明:表达式中有“+”,“-”运算符的,前后必须要有空格。
例如 “width:calc(100% - 20px)”这种写法;
而对于“*”,“/”并没有这种要求,但为了风格的统一,建议前后也要留空格。
对于calc(),总结以下要点:
    1.兼容性:在IE9+、FF4.0+、Chrome19+、Safari6+支持较好,移动端支持不理想;
    2.表达式支持加、减、乘、除运算,同时也支持单位的混合使用(%、px、em等);
    2.表达式中有“+”,“-”运算符的,前后必须要有空格。 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值