n00bster
n00bster

Reputation: 449

Changing colour in Markdown <mark> tag

I currently discovered the markdown element, which lets me mark some text

<mark>Marked text</mark>

This results in this very nice looking pdf-text:

enter image description here

But how do I change the colour from it's default yellow to another colour?

Upvotes: 5

Views: 24461

Answers (3)

Ashar
Ashar

Reputation: 21

You can write

<mark style="background-color:burlywood;">Marked text</mark>

You can replace "burlywood" to any color of your choice.

Upvotes: 2

Giuppox
Giuppox

Reputation: 1621

i would suggest something like this (using inline css). Note that i used !important because in some browsers it may be necessary to force the process.

<mark style="background: #00ced1!important">Marked text</mark>

alternatively, something like this (using external css).

mark {background: red!important}
<mark>Marked text</mark>

in this case the property is applied to all the mark tags in the webpage.
While this method works and is absolutely legitimate, it would be better, and more conventional, to use a css property like this:

<p>this is a pretty paragraph with some <span style="background: blue">marked text</span></p>

hope this helped :)

Upvotes: 9

Waylan
Waylan

Reputation: 42467

The mark tag is not for Markdown, but to mark or highlight text for notation purposes. It essentially is used to make text appear to have been highlighted with a highlighter, which explains the yellow background. Using the inspect tool in my browser, I see that the default styles for mark are:

mark {
  background-color: yellow;
  color: black;
}

So, to change the color, define some CSS. For example:

mark {
  background-color: GreenYellow;
}

Upvotes: 2

Related Questions