父模板
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<div class="container">
<div class="header">
@section('header')
<h1>头</h1>
@show
</div>
<div class="left">
@section('left')
<h1>左</h1>
@show
</div>
<div class="right">
@section('right')
<h1>右</h1>
@show
</div>
<div class="main">
@section('main')
<h1>中</h1>
@show
</div>
<div class="footer">
@section('footer')
<h1>页脚</h1>
@show
</div>
</div>
</body>
<style type="text/css">
.container{
border:3px solid red;
height: 600px;
position: relative;
}
.header{
border:1px solid red;
text-align: center;
overflow:hidden;
top: 0;
width: 100%;
height: 80px;
}
.left{
width: 200px;
height: 400px;
border:1px solid lightgreen;
float: left;
text-align: center;
line-height: 400px;
}
.main{
border:2px solid blue;
height: 400px;
text-align: center;
float: left;
width: 1000px;
}
.right{
width: 200px;
height: 400px;
border:2px solid green;
float: right;
text-align: center;
line-height: 400px;
}
.footer{
border:2px solid lightcoral;
text-align: center;
position: absolute;
bottom: 0;
height: 110px;
width: 100%;
}
</style>
</html>
模板继承
@extends('layout.modelfather')
@section('title',"圣杯")
@section('header')
<h1>header</h1>
@endsection
@section('left')
<h3>left</h3>
@endsection
@section('right')
<h3>right</h3>
@endsection
@section('main')
<h1>圣杯模型</h1>
@endsection
@section('footer')
<h3>footer</h3>
@endsection
![请添加图片描述](https://i-blog.csdnimg.cn/blog_migrate/4e516fcc65e4e737b2e20dd1641eb005.png)