首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >元素在调整页面大小时移动。

元素在调整页面大小时移动。
EN

Stack Overflow用户
提问于 2022-06-25 11:21:11
回答 1查看 43关注 0票数 -1

将元素与CSS和尾风CSS放在一起。

不过,只要我垂直移动页面,元素就会移动。“固定”属性似乎是罪魁祸首,但我不知道如何在没有固定属性的情况下使页面中的元素更低。

目前为止的代码:

代码语言:javascript
复制
  .swipeButtonsXS {
    bottom: 11vh;
    gap: 15px;
  }
}
@media (min-width: 640px) {
  .swipeButtonsSM {
    bottom: 11vh;
    gap: 15px;
  }
}
@media (min-width: 768px) {
  .swipeButtonsMD {
    bottom: 11vh;
    gap: 15px;
  }
}

@media (min-width: 1024px) {
  .swipeButtonsLG {
    bottom: 4vh;
    gap: 15px;
  }
}

@media screen and (min-width: 1280px) {
  .swipeButtonsXL {
    bottom: 31vh;
    gap: 15px;
  }
}
代码语言:javascript
复制
import { FaCheck } from "react-icons/fa";
import "./DatingMainButtons.css";
function DatingMainButtons() {
  return (
    <>
      <div className="fixed w-full flex justify-center swipeButtonsXL swipeButtonsLG swipeButtonsMD swipeButtonsSM swipeButtonsXS ">
        <FaTimes className="xl:w-10 xl:h-10 lg:w-7 lg:h-7 md:w-7 md:h-7 sm:w-6 sm:h-6  xs:w-6 xs:h-6  border border-gray-200  rounded-full bg-white text-gray-300 transition duration-500 ease-in-out  transform hover:-translate-y-1 hover:scale-110" />
        <FaCheck className="xl:w-10 xl:h-10 lg:w-7 lg:h-7 md:w-7 md:h-7 sm:w-6 sm:h-6  xs:w-6 xs:h-6  border border-gray-200  rounded-full bg-white text-gray-600 transition duration-500 ease-in-out  transform hover:-translate-y-1 hover:scale-110" />
      </div>
    </>
  );
}
EN

回答 1

Stack Overflow用户

发布于 2022-06-25 12:05:34

我认为您需要一个带有w-fullh-screenoverflow-autorelative的父级div作为顺风类。您将所有页面内容都放在这个div中,包括按钮组件。简化示例:

代码语言:javascript
复制
<div class="w-full h-full overflow-auto relative">
    <!-- Full width and height container -->
    <div>...Scrollable main content...</div>
    <div class="fixed w-full bottom-4 gap-4 flex justify-center">
        <!-- Fixed button row -->
        <FaTimes class="..."></FaTimes>
        <FaCheck class="..."></FaCheck>
    </div>
</div>

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72753437

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档