Skip to content

Setting background-color style to SVG element #493

Open

Description

@dashie

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

How can I do it?

Activity

  1. dpvc commented on Jan 29, 2024

    @dpvc
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions