RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-581246

danielilinskii's questions

Martin Hope
danielilinskii
Asked: 2024-01-31 16:00:17 +0000 UTC

可折叠立方体

  • 9

描述

大家好!我想制作一个立方体,当你将光标悬停在它上面时,它的边缘应该分开。您还需要在其边缘制作带有文本的箭头,当您悬停时,箭头应沿着其边缘移开,新文本将出现在下方。

.wrap {
  width: 1920px;
  position: relative;
  margin-top: 400px;
  perspective: 1000px;
  perspective-origin: 50% 50%;
}

.leg {
  position: relative;
  width: 0px;
  height: 100px;
  border: 1px solid black;
}

.fr,
.sc,
.th {
  position: relative;
}

.indicator {
  top: -85px;
  left: -170px;
  position: absolute;
}

.line {
  position: absolute;
  overflow: hidden;
  height: 300px;
  /* transform: rotate(45deg); */
}

.text {
  position: absolute;
  top: -120px;
  width: 100px;
}

.h-line {
  width: 100px;
  border: 1px solid black;
}

.d-line {
  margin-left: 86.5px;
  margin-top: 34px;
  width: 100px;
  border: 1px solid black;
  transform: rotate(45deg);
}

.cube {
  margin: auto;
  position: relative;
  height: 200px;
  width: 200px;
  transform-style: preserve-3d;
}

.cube>div {
  position: absolute;
  box-sizing: border-box;
  padding: 10px;
  height: 100%;
  width: 100%;
  opacity: 0.9;
  background-color: #000;
  border: solid 1px #eeeeee;
  color: #ff0000;
}

.legs {
  left: -65px;
  margin-top: 240px;
  position: absolute;
  display: flex;
  flex-direction: row;
  gap: 70px;
}

.sc {
  margin-left: 152px;
}

.th {
  margin-top: -78px;
}

.third {
  margin-top: 78px;
}

.front {
  transform: translateZ(100px);
}

.front--1 {
  transform: translateZ(100px);
}

.back {
  transform: translateZ(-100px) rotateY(180deg);
}

.right {
  transform: rotateY(-270deg) translateX(100px);
  transform-origin: top right;
}

.right--1 {
  transform: rotateY(-270deg) translateX(100px);
  transform-origin: top right;
}

.left {
  transform: rotateY(270deg) translateX(-100px);
  transform-origin: center left;
}

.top {
  transform: rotateX(-270deg) translateY(-100px);
  transform-origin: top center;
}

.top--1 {
  transform: rotateX(-270deg) translateY(-100px);
  transform-origin: top center;
}

.bottom {
  transform: rotateX(270deg) translateY(100px);
  transform-origin: bottom center;
}

.wrap:hover .front {
  transform: translateZ(200px) translateX(-200px);
  /*   margin-left: -200px;
    transition: 0.3s ease-in; */
  background-color: #fcf;
}

.wrap:hover .right {
  transform: rotateY(-270deg) translateZ(150px) translateX(150px);
}

.wrap:hover .top {
  transform: rotateX(-270deg) translateZ(120px) translateY(-100px);
}

.wrap:hover .bottom {
  transform: rotateX(270deg) translateZ(100px) translateY(100px);
}

.wrap:hover .legs {
  transform: translateY(100px);
  transition: transform 0.3s ease-in;
}

.wrap:not(:hover) .legs {
  transform: translateY(0);
  transition: transform 0.3s ease-in;
}

.wrap:hover .first {
  margin-top: 20px;
  transition: 0.3s ease-in;
}

.wrap:not(:hover) .first {
  margin-top: 0;
  transition: 0.3s ease-in;
}

.wrap:hover .second {
  margin-top: 12px;
  transition: 0.3s ease-in;
}

.wrap:not(:hover) .second {
  margin-top: 0;
  transition: 0.3s ease-in;
}

.wrap:hover .third {
  margin-top: -7px;
  transition: 0.3s ease-in;
}

.wrap:not(:hover) .third {
  margin-top: 0;
  transition: 0.3s ease-in;
}

.wrap:hover .text {
  top: 5px;
  transition: 0.3s ease-in;
}

.wrap:not(:hover) .text {
  top: -120px;
  transition: 0.3s ease-in;
}

.cube>div {
  transition: transform 0.3s ease-in;
}

.cube {
  transform: rotateX(-15deg) rotateY(-25deg);
}
<div class="wrap">
  <div class="cube">
    <div class="front">
      <div class="indicator">
        1
        <div class="line">
          <div class="h-line"></div>
          <span class="text">текст текст текст текст текст текст текст текст текст текст текст текст</span>
        </div>
        <div class="d-line"></div>
      </div>
      Front side
    </div>
    <div class="front--1">
      Front side
    </div>
    <div class="top">
      <div class="indicator">
        2
        <div class="line">
          <div class="h-line"></div>
          <span class="text">текст текст текст текст текст текст текст текст текст текст текст текст</span>
        </div>
        <div class="d-line"></div>
      </div>
      Top side
    </div>
    <div class="top--1">
      Top side
    </div>
    <div class="bottom">
      <div class="indicator">
        3
        <div class="line">
          <div class="h-line"></div>
          <span class="text">текст текст текст текст текст текст текст текст текст текст текст текст</span>
        </div>
        <div class="d-line"></div>
      </div>
      Bottom side
    </div>
    <div class="right">
      <div class="indicator">
        4
        <div class="line">
          <div class="h-line"></div>
          <span class="text">текст текст текст текст текст текст текст текст текст текст текст текст</span>
        </div>
        <div class="d-line"></div>
      </div>
      Right side
    </div>

    <div class="right--1">
      Right side
    </div>
    <section class="legs">
      <div class="fr">
        <div class="first leg"></div>
        <div class="indicator">
          4
          <div class="line">
            <div class="h-line"></div>
            <span class="text">текст текст текст текст текст текст текст текст текст текст текст текст</span>
          </div>
          <div class="d-line"></div>
        </div>
      </div>
      <div class="sc">
        <div class="second leg"></div>
        <div class="indicator">
          4
          <div class="line">
            <div class="h-line"></div>
            <span class="text">текст текст текст текст текст текст текст текст текст текст текст текст</span>
          </div>
          <div class="d-line"></div>
        </div>
      </div>
      <div class="th">
        <div class="third leg"></div>
        <div class="indicator">
          4
          <div class="line">
            <div class="h-line"></div>
            <span class="text">текст текст текст текст текст текст текст текст текст текст текст текст</span>
          </div>
          <div class="d-line"></div>
        </div>
      </div>
    </section>
  </div>
</div>

问题

文本箭头不应与其所附着的立方体面位于同一平面,而应始终位于用户的正前方。
预先感谢您的合作!)

html
  • 1 个回答
  • 114 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5