Skip to content
New issue

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

Setting background-color style to SVG element #493

Open
dashie opened this issue Jan 28, 2024 · 1 comment
Open

Setting background-color style to SVG element #493

dashie opened this issue Jan 28, 2024 · 1 comment
Labels

Comments

@dashie
Copy link

dashie commented Jan 28, 2024

I need to set background-color style to SVG element.

How can I do it?

@dpvc
Copy link
Member

dpvc commented Jan 29, 2024

It is not clear what your use case really is. Are you trying to set the background for ALL the SVG elements created by MathJax? If so, you can use CSS to do that. Something like

.MathJax_SVG > svg {
  background-color: red;
}

If you want to control the color from within the expression, that will depend on the input format you are using; you don't stay which that is.

For TeX, you can use \bbox[red]{...} to make the math in its argument have a red background. You may want to use \bbox[red; padding: 3px]{...} to increase the space around the expression that is red.

You can also use \require{color} \colorbox{red}{...}.

For MathML, you would use the attribute mathbackground="red" on any element to make the background red for its contents. It can be used on the <math> tag to make the whole expression have a red background.

There is no mechanism in AsciiMath for making a colored background.

@dpvc dpvc added the Question label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants