diff --git a/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css b/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css index c699e1d0d247..dda21803f373 100644 --- a/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css +++ b/packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css @@ -40,16 +40,12 @@ padding: 0.4rem 0.5rem; position: absolute; right: var(--ifm-pre-padding); - top: var(--ifm-pre-padding); + top: calc(var(--ifm-pre-padding) / 2); visibility: hidden; transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out, bottom 200ms ease-in-out; } -.copyButtonWithTitle { - top: calc(var(--ifm-pre-padding)); -} - .codeBlockTitle:hover + .codeBlockContent .copyButton, .codeBlockContent:hover > .copyButton { visibility: visible; @@ -65,9 +61,3 @@ min-width: 100%; padding: var(--ifm-pre-padding); } - -/* Disable top border radius when title is present. */ -.codeBlockTitle + .codeBlockContent .codeBlockLines { - border-top-left-radius: 0; - border-top-right-radius: 0; -} diff --git a/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css b/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css index c699e1d0d247..9d5e4ad9623a 100644 --- a/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css +++ b/packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css @@ -39,17 +39,13 @@ outline: none; padding: 0.4rem 0.5rem; position: absolute; - right: var(--ifm-pre-padding); - top: var(--ifm-pre-padding); + right: calc(var(--ifm-pre-padding) / 2); + top: calc(var(--ifm-pre-padding) / 2); visibility: hidden; transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out, bottom 200ms ease-in-out; } -.copyButtonWithTitle { - top: calc(var(--ifm-pre-padding)); -} - .codeBlockTitle:hover + .codeBlockContent .copyButton, .codeBlockContent:hover > .copyButton { visibility: visible; @@ -65,9 +61,3 @@ min-width: 100%; padding: var(--ifm-pre-padding); } - -/* Disable top border radius when title is present. */ -.codeBlockTitle + .codeBlockContent .codeBlockLines { - border-top-left-radius: 0; - border-top-right-radius: 0; -}