react-markdown icon indicating copy to clipboard operation
react-markdown copied to clipboard

A strange space like margin-bottom that can not be removed

Open YahngSungho opened this issue 8 years ago • 2 comments

storybook - chrome 2018-10-07 19 07 03

This is source code.

      <div className={css`background-color: gray;`}>
        ↓ here is no margin-top
        <ReactMarkdown className={css`background-color: pink;`}>
          This is the React MarkDown element
        </ReactMarkdown>
        ↑ here is margin-bottom
      </div>

It is important for me to remove that thing like margin-bottom. How can I do that? It is also a good method for me to modify the React Markdown package on local.

What I tried was just to put margin: 0px; padding: 0px; into every components. But it did not work at all.

YahngSungho avatar Oct 07 '18 10:10 YahngSungho

You will have to inspect the elements with your browser dev tools to figure out what is causing this, but I would assume it is caused by the paragraph (containing This is the React MarkDown element) that has margin. You can override the paragraph renderer to customize the styling.

react-markdown doesn't apply any styling, so closing this as it is not a library issue.

rexxars avatar Oct 07 '18 12:10 rexxars

.reactMarkDown {
  padding: 0px;
  margin: 0px;
  margin-top: 0px;
  line-height: unset;
  border: 0px;
  margin: 0px;
  font-size: 14px;
}

.reactMarkDown p {
  margin: 0px;
}

add this css. it is caused by the p tag.

joshcho96 avatar Sep 07 '23 06:09 joshcho96