Skip to content

Commit da03c1e

Browse files
authored
fix: tailwindcss reset Image style (ant-design#39914)
* fix: tailwindcss reset * docs: more info * chore: comment
1 parent 5f40fe8 commit da03c1e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

components/image/style/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,13 @@ export const genImagePreviewStyle: GenerateStyle<ImageToken> = (token: ImageToke
198198
...genBoxStyle(),
199199
transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,
200200

201+
// https://github.com/ant-design/ant-design/issues/39913
202+
// TailwindCSS will reset img default style.
203+
// Let's set back.
204+
display: 'flex',
205+
justifyContent: 'center',
206+
alignItems: 'center',
207+
201208
'&::before': {
202209
display: 'inline-block',
203210
width: 1,

docs/react/compatible-style.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Ant Design supports the last 2 versions of modern browsers. If you need to be co
77

88
### Compatible adjustment
99

10-
Ant Design default using CSS-in-JS with `:where` Selector to reduce priority to avoid user additional adjust style cost when updating. If you want to support old browser, you can use `@ant-design/cssinjs` to adjust this behavior (Please note keep version align with antd):
10+
Ant Design default using CSS-in-JS with `:where` Selector to reduce priority to avoid user additional adjust style cost when updating. If you want to support old browser (or some other CSS framework selector priority conflict like TailwindCSS), you can use `@ant-design/cssinjs` to adjust this behavior (Please note keep version align with antd):
1111

1212
```tsx
1313
import React from 'react';

docs/react/compatible-style.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Ant Design 支持最近 2 个版本的现代浏览器。如果你需要兼容旧
77

88
### `:where` 选择器
99

10-
Ant Design 的 CSS-in-JS 默认通过 `:where` 选择器降低 CSS Selector 优先级,以减少用户升级时额外调整自定义样式成本。在某些场景下你如果需要支持的旧版浏览器,你可以使用 `@ant-design/cssinjs` 取消默认的降权操作(请注意版本保持与 antd 一致):
10+
Ant Design 的 CSS-in-JS 默认通过 `:where` 选择器降低 CSS Selector 优先级,以减少用户升级时额外调整自定义样式成本。在某些场景下你如果需要支持的旧版浏览器(或者如 TailwindCSS 优先级冲突),你可以使用 `@ant-design/cssinjs` 取消默认的降权操作(请注意版本保持与 antd 一致):
1111

1212
```tsx
1313
import React from 'react';

0 commit comments

Comments
 (0)