laravel 圣杯布局

本文介绍了一种利用Flex布局实现的圣杯布局方案,包括header、footer、左侧、中间和右侧的内容区域。代码示例展示了如何设置CSS样式以达到预期效果,其中`flex-grow`、`order`属性是关键。此外,还提供了一个子模板继承示例,用于展示内容填充。
摘要由CSDN通过智能技术生成

圣杯布局

<body>
     <header>header</header>
     <div class="flex-box" >
        <div class="flex-left">@yield('left')</div>
        <div class="flex-center">@yield('text')</div>

        <div class="flex-right">@yield('right')</div>
     </div>
     <footer>footer</footer>
</body>

继承

@extends('layout.shengbei')
@section('title','添加用户')
@section('content')
<x-alert ></x-alert>

@parent
@endsection

圣杯样式

<style>
   * {
       color: #fff;
       text-align: center;

   }
   header {
       background-color: lightblue;
       height: 150px;
       width: 100%;
        line-height: 150px;
        color:black;
   }
   .flex-box {
       display: flex;
   }
   .flex-center {
       background-color:#DCB5FF;
       flex-grow: 1;
       height: 400px;
       width: 50px;
        line-height: 400px;
   }
   .flex-left {
       background-color: 		#81C0C0;
       order: -1;
       flex: 0 0 100px;
       height: 400px;
       width: 50px;
        line-height: 400px;

   }
   .flex-right {
       background-color: 		#C1FFE4;
       flex: 0 0 100px;
       height:400px;
       width: 50px;
        line-height: 400px;
   }
   footer {
       background-color: 	#E0E0E0;
       height: 150px;
       width: 100%;
        line-height: 150px;
        color:black;
   }
</style>

在这里插入图片描述

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值