Replies: 17 suggested answers 18 replies
-
|
Settings |
Beta Was this translation helpful? Give feedback.
-
|
Can you explain the problem more clearly and show the old behavior compared to the new behavior so we can understand what has actually changed for you? |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
Loading...
Sorry, something went wrong.
-
|
When I upgrade 3.0.0-alpha.1 Default base button style like if Settings |
Beta Was this translation helpful? Give feedback.
-
|
Looks like you have your CSS in a bad order — you should make sure your The order needs to be like this: @tailwind base;
@tailwind components;
.n-button { /* ... */ }
@tailwind utilities;Giving you control over this order is the reason Tailwind provides three layers for the styles. Those styles are there in v2 as well, just organized very slightly differently but not in a way that should impact this: https://unpkg.com/tailwindcss@2.2.19/dist/base.css Going to convert this to a help discussion, but if there is a real issue here that I'm missing (there totally could be, sorry if so!) please open a new issue and follow the issue template, including providing a proper reproduction repository. |
Beta Was this translation helpful? Give feedback.
-
|
I upgraded to 3.0 and the background colors on my MUI Button component went transparent. I don't want to completely disable the preflight. How can I only disable the button > background-color: transparent? |
Beta Was this translation helpful? Give feedback.
-
|
I have the same problem, but only when building my react app. Everything works when using development build. |
Beta Was this translation helpful? Give feedback.
-
|
I also noticed this change, it looks to just be an update to the reset in V3 that now sets the background color to be transparent. My fix was to just switch the order of imports and make sure my (legacy) custom CSS was imported after Tailwind so that it won. |
Beta Was this translation helpful? Give feedback.
-
|
Same problem with element-plus. |
Beta Was this translation helpful? Give feedback.
-
|
I also encountered this problem, I hope there will be a solution |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
Loading...
Sorry, something went wrong.
-
|
I make several ways to solve problem. If you have installed
Temporary SolutionNow, you need get ready with these files:
Edit your html as below, <!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Your site title</title>
</head>
<body>
<div id="app"></div>
<!-- <script type="module" src="/src/tailwindcss.ts"></script> -->
<script type="module" src="/src/main.ts"></script>
</body>
</html>Remeber a bit modify with main.ts import "@/assets/styles/index.scss";Here is my @import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
// other basic style your project needs
@import './transition.scss';
/**
* element plus style reset
*/
.el-popper {
max-width: 480px;
}Most important one with import { resolve } from "path";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import analyze from "rollup-plugin-visualizer";
export default defineConfig({
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
build: {
rollupOptions: {
plugins: [analyze()],
output: {
manualChunks(id) {
// 更新日期:2022年06月09日
// 下面这三行css代码打包的配置可以随你移除或者保留~移除后会自动生成一个css,和下面的示例图会有区别。
if (id.includes("assets/styles/index.scss")) {
return "tailwindcss";
}
if (id.includes("element-plus/theme-chalk/")) { // 当然也可以优化下这个判断,不过目前这样写足矣了。
return "element-plus";
}
},
},
},
},
server: {
proxy: {
"/api": {
target: "http://x.x.x.x:xx",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, "/api"),
},
},
},
});Please keep eyes on
At last, I need to show what I have researched for this problem, vite has lots of issues about this similar questions, such as:
It seems that will be fixed sooner or later. And my solution mostly inspired by vitejs/vite#6375 relative issues: #6602 我目前有几个办法来解决。当前我使用的是
Even though solve the button style, but conflict still there, so I think we should make sure keep tailwindcss style first, and do not modify it, espacially disable preflight. Try to let other style(maybe UI framework) override it. |
Beta Was this translation helpful? Give feedback.
-
|
I solved this creating custom classes with For someone like me that haved this problem ;) |
Beta Was this translation helpful? Give feedback.
-
|
Excluding classes may be the solution. (May not be applicable for different scenarios) Example: button:not(.x-class, .y-class, .z-class),
[type='button']:not(.x-class, .y-class, .z-class),
[type='reset']:not(.x-class, .y-class, .z-class),
[type='submit']:not(.x-class, .y-class, .z-class) {
-webkit-appearance: button; /* 1 */
background-color: transparent; /* 2 */
background-image: none; /* 2 */
}I have no solution for this situation other than manually editing the generated css! I'm sure a lot of people will be pleased if a solution can be found to this. |
Beta Was this translation helpful? Give feedback.
-
|
I can assure that the same issue still happens with MUI in the current version of tailwind (3.1.2). I don't want to disable the preflight interely because the missing of the default styles breaks most of the application. Does anyone discovered a way to safely disable/override the default button style? |
Beta Was this translation helpful? Give feedback.
{{editor}}'s edit
{{editor}}'s edit
Loading...
Sorry, something went wrong.
-
|
Even i faced the same issue but I am using
but this is kinda "hack", this either need to be fixed by |
Beta Was this translation helpful? Give feedback.
-
|
This is also breaks the AntDesign component library. Sad that this has been an issue for so long without being addressed. |
Beta Was this translation helpful? Give feedback.
-
|
I also have the same problem: Tailwindcss and vant ui, which is automatically introduced on demand using unplugin-vue-components, have found the button style conflict problem. I don't know if there is a solution now? |
Beta Was this translation helpful? Give feedback.
-
|
Ant Design 5.0 use css-in-js to generate button style instead of Less. However, the new generated style has pseudo-class function Is there any way to solve this problem? |
Beta Was this translation helpful? Give feedback.




-
How to remove this default style Now it's affecting This kind of writing
background-color: var(--color)tailwindcss The weights are higher than himBeta Was this translation helpful? Give feedback.