我完全按照教程的要求做了一个网站,同时使用了Live服务器扩展,它正在应用中.我使用Chrome、Edge和Opera判断了.html文件本身,但没有应用任何样式,事实上它仍然显示为应用在实时服务器扩展中

The files

Index.html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link href="/dist/output.css" rel="stylesheet" />
  </head>
  <body class="m-0 bg-blue-500 p-0">
    <nav class="m-0 h-full w-full space-x-4 border bg-blue-400 p-6">
      <h1 class="text-3xl font-bold drop-shadow-md md:filter-none">
        Safer Internet
      </h1>
      <div
        class="absolute top-7 right-14 space-x-10 stroke-2 font-extrabold hover:stroke-black"
      >
        <button
          class="position inline-block text-right duration-700 hover:text-white"
        >
          <a href="./index.html">Home</a>
        </button>
        <button
          class="position inline-block text-right duration-700 hover:text-white"
        >
          <a href="./More.html">More</a>
        </button>
        <button
          class="position inline-block text-right duration-700 hover:text-white"
        >
          <a href="./About.html">About</a>
        </button>
      </div>
    </nav>
    <div>
      <p
        class="absolute left-64 top-2/4 translate-x-2/4 translate-y-2/4 text-center text-xl font-bold"
      >
        To be able to know how to be safe on the internet click the button
        bellow.
      </p>
      <div
        class="relative top-96 flex translate-y-2/3 items-center justify-center text-center"
      >
        <button
          class="relative top-9 w-1/6 rounded-xl bg-blue-900 p-4 font-extrabold duration-700 hover:bg-black hover:text-white"
        >
          <a href="./More.html">More</a>
        </button>
      </div>
    </div>
  </body>
</html>

Trawind.config.js:

module.exports = {
  content: ["./src/**/*.{html,js}", "./public/*.html"],
  theme: {
    extend: {},
  },
  plugins: [],
}

Style.css:

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

我try 了所有的方法,但都不起作用,我希望这些样式能在我的浏览器上apply.

推荐答案

Proper approach to follow when using Tailwind-CLI

1. Know about your file structure. Use:

public
|_ tailwind_base.css 
   ???? File from which the output.css is produced
     @tailwind base;
     @tailwind components;
     @tailwind utilities;
|_ output.css
src
|_ index.html   
  ???? Link with the output.css using 
    <link href="../public/output.css" rel="stylesheet" />

Watch it as

npx tailwindcss -i ./public/tailwind_base.css -o ./public/output.css --watch

Specify your html/js in tailwind.config.js

module.exports = {
  content: ["./src/**/*.{html,js}"],
  theme: {
    extend: {},
  },
  plugins: [],
};

在您的index.html文件????中愉快地使用tailwindcss classes

Html相关问答推荐

仅包含名为X的子元素的元素的XPath?

HTML表行悬停仅适用于偶数行

连续的相同 colored颜色 单元格应位于同一列、网格框中

浏览器是在调整大小还是在全屏上交换视频源?

正文不能填满浏览器100%的高度

滚动两个不同高度的DIV;一个等待另一个

Style=背景图像URL引用变成&;Quot;

Chatbox底部显示新消息,并向上推送旧消息

禁用所有行,但在16角中单击编辑按钮的行除外

如何使用 Flutter 构建 Chrome 扩展?

如何检测输入字段是否没有必填且没有占位符?

使用 calc 函数设置字体大小时 Flexbox 项目重叠

将 HTML 元素粘贴到容器底部,而不剪裁其顶部

我用 ejs 修复了一个奇怪的语法错误,我想知道问题出在哪里

使用 Selenium for Python 在网站上查找类名称中包含换行符的元素

有没有办法使用 CSS border-radius 创建 HTML 视频标签的三角形显示?

辅助功能:alt 或 alt="" 用于装饰图像

下拉菜单项在页面加载时显示,需要隐藏直到悬停

如何将图像高度设置为等于文本高度?

如何在 about:blank 网站上设置页面标题