- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在构建我的个人网站,我只想显示 Navbar
、Hero
和 Footer
组件。
我可以这样做,但是,我的页脚在底部,但我必须再滚动一点才能看到它。
我已将我的 Hero
设置为具有 h-screen 的类名来填充屏幕。即使没有 Footer 组件,我的主页仍然有轻微的滚动。
无论如何,我可以停止它并使它只有一个尺寸而没有滚动以适合屏幕吗?
我的Footer.js
import React from "react";
import { FaGithub } from "react-icons/fa";
import { Link } from "react-router-dom";
const Footer = () => {
return (
<div className="bg-transparent flex justify-center items-center h-16 bg-transparent text-gray-500">
(c) 2021 Callum Lees - All rights reserved.{" "}
<Link to={{ pathname: "https://github.com/" }} target="_blank">
<FaGithub className="ml-4 hover:text-blue-300" />
</Link>
</div>
);
};
export default Footer;
我的 Hero.js
组件
import React from "react";
import { Link } from "react-router-dom";
const Hero = () => {
return (
<div className="flex flex-col min-h-screen justify-center items-center overflow-auto relative mb-auto">
{/* items-center */}
<h1 className="lg:text-6xl md:text-7xl sm:text-6xl text-7xl pl-8 bg-clip-text text-transparent bg-gradient-to-r from-blue-400 to-green-500 font-black mb-7 ml-24 mr-24">
<h1 className="lg:text-4xl md:text-5xl sm:text-4xl text-5xl font-normal text-gray-800">
Hi,
</h1>
{/*bg-clip-text text-transparent bg-gradient-to-r from-blue-600 to-purple-500 */}
I'm Callum.
</h1>
<Link
to="/projects"
className="py-3 px-5 text-sm text-gray-700 transition duration-300 ease-in-out flex items-center lg:text-xl md:text-base sm:text-sm"
>
ALL PROJECTS
<svg
className="w-6 h-6 ml-4 animate-bounce text-blue-500"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M14 5l7 7m0 0l-7 7m7-7H3"
/>
</svg>
</Link>
</div>
);
};
export default Hero;
我的 Navbar.js
组件
import React from "react";
import { Link } from "react-router-dom";
const Navbar = ({ toggle }) => {
return (
<nav
className="flex justify-between items-center h-16 bg-transparent text-black font-sans"
role="navigation"
>
<Link
to="/"
className="pl-8 font-black hover:text-blue-600 flex items-center"
>
<svg
className="w-6 h-6"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"
/>
</svg>
C-L
</Link>
<div className="pr-8 cursor-pointer md:hidden" onClick={toggle}>
<svg
className="w-6 h-6"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M4 8h16M4 16h16"
/>
</svg>
</div>
<div className="pr-8 md:block hidden">
<Link className="p-4 hover:text-blue-600" to="/">
Home
</Link>
<Link className="p-4 hover:text-blue-600" to="/projects">
Projects
</Link>
<Link className="p-4 hover:text-blue-600" to="/contact">
Contact
</Link>
</div>
</nav>
);
};
export default Navbar;
最佳答案
这是弹性布局的简单使用。 flex-1
是你的 friend 。无论设备高度如何,这项工作都非常出色。不再滚动。 checkout working modal
<div class="flex flex-col h-screen">
<div class="flex bg-red-100">Header</div>
<div class="flex flex-1 bg-gray-100">Body</div>
<div class="flex bg-blue-100">Footer</div>
</div>
关于ReactJS 和 Tailwind CSS - 使用 h-screen 过度滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65963361/
我想将颜色变量(默认或扩展)用于我的扩展主题,例如: module.exports = { content: ['./index.html', './src/**/*.{js,ts,jsx,t
我们如何在 Tailwind 中设置单个列的宽度? 例如在 Vanilla CSS 我会 .grid-container { display: grid; grid-template-colu
我是 Tailwind CSS 的新手。我在构建 React 项目时遇到了这个错误: The hover: class does not exist. If hover: is a custom cl
为什么 tailwind 中没有太多的百分比单位,例如我想要 50% 的宽度。我知道我可以向它添加自定义配置,但我只是想知道是否有任何特定原因。 最佳答案 我会说这更像是一种个人偏好的编码风格。使用后
我正在尝试将项目对齐到屏幕右侧并使其粘滞。 但正如你在这个 sandbox 中看到的那样它不起作用。 未应用正确的属性。 我该怎么办? 最佳答案 这也行 hossein 关于tailwind-
是否可以在 tailwind 配置中使颜色动态化。 我想从后端通过 api 接收所需的(primary,accent)颜色。 因此用户可以从管理面板更改颜色。 我想从 api 获取这个十六进制值 最佳
我正在尝试使用顺风基于系统默认值启用暗模式。 为此,我使用了插件: Tailwind dark mode 。 我的顺风配置失败如下: defaultTheme = require('tailwindc
我有几个消息框,每个框都有一个数据作者属性。 如果我想在 CSS 中对这些消息框应用样式,我可以这样做: [data-author="Ben"] { background-color: blue;
没有错误,但 Tailwind 没有应用任何样式: 包.json "dependencies": { "tailwindcss": "npm:@tailwindcss/postcss7-com
我想要transition-transform 和transition-shadow,既不是transition-all 也不是只有一个。把这两个不影响,我找不到它的文档,我尝试像这样玩:transi
我正在尝试使用 webpack 5 和 tailwind 2。日志表明大多数事情都设置正确,但没有进行清除。 我跑 NODE_ENV=production webpack --config webpa
我正在尝试 extend使用他们的 tailwind.config.js 的 tailwind css 调色板文件。我的目标是创建一组主要和次要颜色,我可以在设计我的网站时使用它们。我想通过从默认的顺
我一直在使用带有“清除”选项的 Tailwind 来使最终的 css 文件更小且成功。但是,我一直想知道我的方法的效率。我正在处理有很多子文件夹的项目,我都指定如下: purge: {
你如何在 Tailwind 中设置整页背景? 我可以看到使用的唯一属性是 h-screen ,但是当我调整浏览器大小时这不起作用。 这是我的代码: 完整的 html 示例:
将顺风 CSS 包含在我不希望它全局应用的系统中时,我找不到一个很好的方法来确定适用于自定义构建选项的范围。 基本上我想这样做: .tailwind{ @import "tailwindcss
我正在学习 Tailwind CSS。据我了解,如果您想设置元素的样式,请向其添加 Tailwind 实用程序 css 类。想给多个相似元素设置样式怎么办?例如,我有以下 HTML 片段:
我正在学习 Tailwind CSS。据我了解,如果您想设置元素的样式,请向其添加 Tailwind 实用程序 css 类。想给多个相似元素设置样式怎么办?例如,我有以下 HTML 片段:
我需要将所有具有相应响应尺寸的边距值列入白名单。 例子: 'mb-10' 'md:mb-10' 'xl:mb-10' 等等。 这是我现在在我的 tailwind.config.js 中的内容,但它似乎
我一直在尝试使用 Tailwind 来自定义 Quasar 组件,但 Quasar CSS 已经覆盖了大部分 Tailwind CSS。 我在我的 tailwind.config.js 中添加了一个前
我必须并排放置两列。这些列之一具有固定宽度。我真的很想理解为什么一列中的固定宽度在 Tailwind CSS flexbox 上不起作用。 我有以下代码: This title pushed
我是一名优秀的程序员,十分优秀!