Skip to content

specify position: relative for .katex#3859

Closed
mikeguo99 wants to merge 1 commit intoKaTeX:mainfrom
mikeguo99:main
Closed

specify position: relative for .katex#3859
mikeguo99 wants to merge 1 commit intoKaTeX:mainfrom
mikeguo99:main

Conversation

@mikeguo99
Copy link
Copy Markdown

What is the previous behavior before this PR?

The class .katex-mathml inside .katex has specified position: absolute, but since .katex has not specified position: relative, .katex-mathml will keep looking up layer by layer, potentially causing layout chaos.

What is the new behavior after this PR?

After specifying position: relative for .katex, the position of .katex-mathml has stabilized.

@edemaine
Copy link
Copy Markdown
Member

edemaine commented Dec 8, 2024

Could you clarify in what scenario the layout of .katex-mathml matters, given that it's clipped to be invisible? Do you have an example of resulting "layout chaos"?

@moesoha
Copy link
Copy Markdown

moesoha commented Feb 11, 2025

@edemaine If using KaTeX within scrollable content on a page, it will break the outer height.

<body>
<div style="max-height: 80vh; overflow: auto; border: 1px solid #000;">
	<div style="height: 200vh;"></div>
	<span class="katex"><span class="katex-mathml"></span></span>
</div>
</body>

image

@shinexyt
Copy link
Copy Markdown

shinexyt commented Feb 19, 2025

Same issue as @moesoha in Microsoft Edge 133.0.3065.69

@enzo2
Copy link
Copy Markdown

enzo2 commented Jun 8, 2025

Also encountered. It does cause layout chaos and break my outer height, and adding .katex {position: relative;} fixes it.

@will961123
Copy link
Copy Markdown

I'm having the same issue and hope it can be merged as soon as possible.

@edemaine
Copy link
Copy Markdown
Member

Replaced by #4170

@edemaine edemaine closed this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants