我刚刚开始学习TailWind CSS,一整天我都在试图理解为什么space-x-n不适合我 我在谷歌上到处搜索,但都没找到

这是我的代码:

<nav class="bg-gray-800">
    <div class="max-w-7xl mx-auto">
        <div class="flex justify-between">
            <div class="flex space-x-4">
                <div>
                    <a href="#">
                        <img src="/src/logo.png" style="height:40px;" alt="logo">
                    </a>
                </div>
                <div>
                    <a href="">Features</a>
                    <a href="">Pricing</a>
                </div>
            </div>
            <div>secondary nav</div>
        </div>
    </div>
</nav>

这是我的app.css

@tailwind base;
@tailwind components;
@tailwind utilities;

配置文件

const defaultTheme = require('tailwindcss/defaultTheme');

/** @type {import('tailwindcss').Config} */
module.exports = {
    content: [
        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
        './storage/framework/views/*.php',
        './resources/views/**/*.blade.php',
        './resources/js/Pages/*.vue',
    ],
    theme: {
        extend: {
            fontFamily: {
                sans: ['Nunito', ...defaultTheme.fontFamily.sans],
            },
        },
        screens:{
            sm: '480px',
            md: '768px',
            lg: '976px',
            xl: '1440px'
        }
    },

    plugins: [require('@tailwindcss/forms')],
};

推荐答案

判断生成的标记,如果没有space-x-4,则可能是构建步骤中有错误.该文件也可能不是已配置的tailwind 内容文件的一部分.

您的标记看起来是正确的.gap-x-4space-x-4都应该在包含的两个div之间提供16px的间隙.

作为解决办法,您可以为包含徽标的第一个div设置mr-4%的边距.

https://tailwindcss.com/docs/gap#changing-row-and-column-gaps-independently

Css相关问答推荐

如何使一组元素的行为像字符串一样?

如何获得特定位置的Divs以根据浏览器宽度正确调整大小

如何防止背景重复图像被截断

更改MAT-FORM-FIELD的CSS,使其在有Angular 的HTML中显示为普通文本框

解释 "document.styleSheets[0].cssRules[0].style;"

使用CSS Grid是否可以跳过下一列?

使用 flexbox 使图像与内容高度相同

CSS 仅过渡背景 colored颜色

使用 node-sass 在压缩文件末尾添加 min.css 文件扩展名

老虎机插槽上的 CSS 对齐问题

Tailwind:如何设置网格的自动填充?

纯 CSS/JS 的 SVG 连续向内方形螺旋动画

在嵌套的弹性框中创建弹性项目之间的空间

纯 CSS 滚动动画

下拉框中溢出文本的省略号

如何强制显示垂直滚动条?

如何使内容出现在固定的 DIV 元素下方?

CSS3 box-shadow:inset 可以只做一侧或两侧吗?喜欢边界顶部?

CSS - 悬停穿过元素以激活悬停在被覆盖的元素上

CSS - 使 div 水平对齐