弘帝企业智能建站系统交流平台

 找回密码
 立即注册
查看: 1307|回复: 0

【CSS3】上左右下框架自适应支持手机

[复制链接]
发表于 2020-9-28 22:12:46 | 显示全部楼层 |阅读模式
DIV:
  1. <div class="header">$top[        DISCUZ_CODE_2        ]lt;/div>
  2. <div class="flex">
  3.         <div class="sider">$sider[        DISCUZ_CODE_2        ]lt;/div>
  4.         <div class="frame">$body[        DISCUZ_CODE_2        ]lt;/div>
  5. </div>
  6. <div class="footer">$bottom[        DISCUZ_CODE_2        ]lt;/div>
复制代码


CSS:
  1. $fst: #cc0000 !default;
  2. $sec: #ffff00 !default;
  3. $thd: #82e0e8 !default;
  4. $fth: #031618 !default;
  5. $gray-600: #6c757d !default;
  6. $gray-800: #343a40 !default;

  7. body, html {
  8.         margin: 0;
  9.         padding: 0;
  10.         height: 100%;
  11.         display: flex;
  12.         flex-direction: column;
  13. }

  14. .header {
  15.         background: $fth;
  16.         display: flex;
  17.         align-items: center;
  18.         width: 100%;
  19.         height: 50px;
  20.         justify-content: space-between;
  21.         * {
  22.                 color: #fff;
  23.         }

  24.         .user {
  25.                 background: $fst;
  26.                 color: #fff;
  27.                 padding: 0 10px;
  28.                 border-radius: 10px;
  29.                 margin-right: 10px;
  30.                 border: 2px solid #800;
  31.         }
  32. }

  33. .footer {
  34.         display: flex;
  35.         flex-direction: column;
  36.         width: 100%;
  37.         min-height: 30px;
  38.         justify-content: center;
  39.         align-items: center;
  40.         background: $gray-600;
  41.         padding-top: 5px;
  42.         padding-bottom: 5px;

  43.         * {
  44.                 color: #ccc;
  45.                 font-size: 12px;
  46.         }

  47.         label {
  48.                 margin: 0;
  49.         }
  50. }

  51. .flex {
  52.         display: flex;
  53.         flex-direction: row;
  54.         flex: 1;
  55.         position: relative;
  56. }

  57. .sider {
  58.         position: absolute;
  59.         top: 0;
  60.         height: 100%;
  61.         z-index: 10;
  62.         background: rgba($color:$gray-600,$alpha:.9);
  63.         border-left: 10px solid rgba($color:$gray-600,$alpha:.9);

  64.         &:hover {
  65.                 border-left: 0;
  66.                 width: 220px;

  67.                 ul {
  68.                         display: block;
  69.                 }
  70.         }

  71.         ul {
  72.                 display: none;

  73.                 li {
  74.                         background: rgba($color:$gray-800,$alpha:.9);

  75.                         a {
  76.                                 display: flex;
  77.                                 padding: 8px 8px 8px 30px;
  78.                                 color: #ccc;

  79.                                 &:hover {
  80.                                         color: #fff;
  81.                                 }
  82.                         }

  83.                         ul {

  84.                                 li {
  85.                                         background: rgba($color:$gray-600,$alpha:.9);

  86.                                         a {
  87.                                                 padding: 5px 8px 5px 30px;
  88.                                                 font-size: 12px;
  89.                                         }
  90.                                 }
  91.                         }
  92.                 }
  93.         }
  94. }

  95. .frame {
  96.         display: flex;
  97.         flex: 1;
  98.         padding: 20px;

  99.         iframe {
  100.                 width: 100%;
  101.         }
  102. }

  103. @media(min-width:576px) {
  104.         .sider {
  105.                 position: relative;
  106.                 border-left: 0;
  107.                 flex: 0 1 220px;

  108.                 ul {
  109.                         display: block;
  110.                 }
  111.         }

  112.         .footer {
  113.                 flex-direction: row;
  114.                 justify-content: flex-end;
  115.         }
  116. }

复制代码

Hondy.Site.User.Login.css页面参考
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|弘帝企业智能建站系统 ( 皖ICP备07503252号 )

GMT+8, 2024-4-20 18:27 , Processed in 0.058500 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表