We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.0.8
Taro 4.0.9
No response
import '@tarojs/taro/html.css'; 引入html.css后使用div,部分样式就会失效,比如flex。但是不引用这个默认浏览器css样式,跟html标签的默认样式就不一样了
import '@tarojs/taro/html.css';
<> <div className='h-[300px]'></div> <View className='flex'> <Text className='w-14 flex-none '>Hello </Text> <Text className='w-64 flex-1 '>Hello </Text> <Text className='w-64 flex-1 '>Hello </Text> </View> <div className='flex flex-row'> <div className='w-64 flex-1'>Hello1 </div> <div className='w-64 flex-1'>Hello1 </div> <div className='w-64 flex-1'>Hello1 </div> </div> </>
引入import '@tarojs/taro/html.css';后样式就无法生效。 3.x版本时没有这个问题
正常的样式表现
1
win11 nodejs20
The text was updated successfully, but these errors were encountered:
你现在使用的 tailwindcss 版本是什么? 有最小化的复现案例吗?
3.x版本时没有这个问题
这个是指 weapp-tailwindcss@3 还是 tailwindcss@3?
Sorry, something went wrong.
感谢回复,weapp-tailwindcss@3和tailwindcss@3是我项目在使用的,最近打算升级到tailwindcss@4. 我先在我项目尝试移植发现很多样式都丢失了, 随后我在您提供的Taro示例工程https://github.com/icebreaker-template/taro-webpack-tailwindcss-v4 tailwindcss@4版本示例中进行测试。
逐一对比示例代码和我项目代码,发现https://docs.taro.zone/docs/use-h5 使用html标签引入html4/html5的内置样式后,就会发生样式丢失现象。
查看wxml,使用div引入html样式后和view生成的css样式一摸一样,div会加入h5-div类名。使用div的就会丢失样式
了解,你先可以使用 weapp-tailwindcss@4 + tailwindcss@3 也是兼容的 tailwindcss@4 breaking change 经常会产生,不够稳定。 我先自己复现一下你这种情况。
sonofmagic
No branches or pull requests
weapp-tailwindcss 版本
4.0.8
框架 & 小程序平台
Taro 4.0.9
最小复现bug的代码仓库链接
No response
复现bug的步骤
import '@tarojs/taro/html.css';
引入html.css后使用div,部分样式就会失效,比如flex。但是不引用这个默认浏览器css样式,跟html标签的默认样式就不一样了
引入import '@tarojs/taro/html.css';后样式就无法生效。 3.x版本时没有这个问题

预期是什么?
正常的样式表现
实际发生了什么?
1
运行环境
其他附加信息
No response
The text was updated successfully, but these errors were encountered: