html {
    transition: all 0.5s ease-out;
  }
  
  *, *::before, *::after {
    box-sizing: border-box;
  }
  
  .split-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    background-color: #111;
  }
  
  .box {
    position: relative;
    flex-basis: 50%;
    height: 100%;
    transition: 0.6s all cubic-bezier(0.2, 0.6, 0.7, 1);
    background-position: center;
  }
  
  .box:hover {
    flex-basis: calc(100% / 13 * 9);
  }
  
  .box__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: 0.8s all ease-out;
    transition: 0.8s all cubic-bezier(1, 0, 0, 1);
  }
  
  .box-1 {
    background-size: cover;
    font-family: 'Kanit', sans-serif;
  }
  
  .box-1 .box__overlay {
    background-color: rgba(96, 155, 116, 0.2);
  }
  
  .box-1:hover .box__overlay {
    background-color: rgba(96, 155, 116, 0.1);
  }
  
  .box-1 .box__title {
    position: absolute;
    bottom: 0;
    text-align: left;
    margin: 0.5em 0.8em;
    color: white;
    font-size: calc(30px + 20 * ((100vw - 320px) / 680));
    word-spacing: 100vw;
  }
  
  .box-2 {
    background-size: cover;
    font-family: 'Kanit', sans-serif;
  }
  
  .box-2 .box__overlay {
    background-color: rgba(96, 155, 116, 0.8);
  }
  
  .box-2:hover .box__overlay {
    background-color: rgba(0, 157, 157, 0.5);
  }
  
  .box-2 .box__title {
    position: absolute;
    bottom: 0;
    text-align: right;
    margin: 0.5em 0.8em;
    color: #fff;
    font-size: calc(30px + 15 * ((100vw - 320px) / 680));
    word-spacing: 100vw;
  }
<!DOCTYPE html>
<html>

<head>
  <title>Oco, online coworking</title>
  <meta charset="UTF-8">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Kanit:wght@200&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="{{ url_for('static', filename='css/home.css') }}" type="text/css">
</head>

<body>

<section class="split-view">
  <div class="box box-1">
    <a href="{{ url_for('study_hub')}}" class="box__overlay">
      <h1 class="box__title">Study Hub</h1>
    </a>
  </div>

  <div class="box box-2">
    <div class="box__overlay">
      <h1 class="box__title">About</h1>
    </div>
  </div>
</section>

</body>

</html>

complete beginner, stuck at this, 'elp

I'm trying to access the individual boxes' css so I can change the ratio to a 70/30 screen layout, rather than the current 50/50, but no matter what I change it either completely scuffs my transitions, or the whole thing breaks.
Any of my trial and error details will likely not be of any help either, sooo sorry to just hand this to you. <3

推荐答案

这就是你要找的吗?只需给方框单独的flex-basis个值.现在,它们的价值都是50%.即使你把它改成70%,它们都有相同的值,它们都不能接受70%,所以它实际上保持在50%.

html {
    transition: all 0.5s ease-out;
  }
  
  *, *::before, *::after {
    box-sizing: border-box;
  }
  
  .split-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    background-color: #111;
  }
  
  .box {
    position: relative;
    height: 100%;
    transition: 0.6s all cubic-bezier(0.2, 0.6, 0.7, 1);
    background-position: center;
  }
  
  .box:hover {
    flex-basis: calc(100% / 13 * 9);
  }
  
  .box__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: 0.8s all ease-out;
    transition: 0.8s all cubic-bezier(1, 0, 0, 1);
  }
  
  .box-1 {
    flex-basis: 30%;
    background-size: cover;
    font-family: 'Kanit', sans-serif;
  }
  
  .box-1 .box__overlay {
    background-color: rgba(96, 155, 116, 0.2);
  }
  
  .box-1:hover .box__overlay {
    background-color: rgba(96, 155, 116, 0.1);
  }
  
  .box-1 .box__title {
    position: absolute;
    bottom: 0;
    text-align: left;
    margin: 0.5em 0.8em;
    color: white;
    font-size: calc(30px + 20 * ((100vw - 320px) / 680));
    word-spacing: 100vw;
  }
  
  .box-2 {
    flex-basis: 70%;
    background-size: cover;
    font-family: 'Kanit', sans-serif;
  }
  
  .box-2 .box__overlay {
    background-color: rgba(96, 155, 116, 0.8);
  }
  
  .box-2:hover .box__overlay {
    background-color: rgba(0, 157, 157, 0.5);
  }
  
  .box-2 .box__title {
    position: absolute;
    bottom: 0;
    text-align: right;
    margin: 0.5em 0.8em;
    color: #fff;
    font-size: calc(30px + 15 * ((100vw - 320px) / 680));
    word-spacing: 100vw;
  }
<!DOCTYPE html>
<html>

<head>
  <title>Oco, online coworking</title>
  <meta charset="UTF-8">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Kanit:wght@200&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="{{ url_for('static', filename='css/home.css') }}" type="text/css">
</head>

<body>

<section class="split-view">
  <div class="box box-1">
    <a href="{{ url_for('study_hub')}}" class="box__overlay">
      <h1 class="box__title">Study Hub</h1>
    </a>
  </div>

  <div class="box box-2">
    <div class="box__overlay">
      <h1 class="box__title">About</h1>
    </div>
  </div>
</section>

</body>

</html>

Html相关问答推荐

<mat-toolbar更改所有页面的高度

在css中,如何在英雄版块的标题后面做一个粘性的导航栏?

如何在R中渲染Quarto文档时动态设置html文件名

carousel 的垂直滚动按钮居中

配置了 HTML 视口的 Google Apps 脚本移动网络应用程序无法正确显示

网格项未在同一行上对齐

如何从 div 内的图像中删除填充而不从其他所有内容中删除填充?

为什么 Flexbox 中相邻元素上的 flex:1 会影响另一个元素的固定宽度?

这两个CSS中的网格居中对齐内部盒子有什么区别?

Bootstrap 轮播内容在箭头之间不显示

调整屏幕大小时标题在图像下方重叠 - HTML

输入框不是全宽

使用 R 中的 rvest 包获取搜索结果的第一个链接

如何从另一个 ng-template 获取输入值

如何在div中设计伪元素?

标签背景 colored颜色 的 html 和 css 技巧说明

Css 左属性问题

每次按下按钮时减小字体大小的 jquery 函数

Header 或 P 标记中的填充不能与 em 单元一起正常工作

我怎么能有 :not(.class):nth-of-type(even)?