如何使用Markdig生成内联html?

问题描述 投票:0回答:1
c# html blazor markdig
1个回答
0
投票

如果

MarkupString
将输出块内容,则 HTML 标准不允许将此内容包装在
<span>
<p>
中。您可以使用
<div>
,它可以包含任何内容。

display:inline

display:inline-block
 相比,
Flexbox 通常是将多个(块)元素放置在一行上的更好、更灵活的方式。 CSS Tricks 有一个很好的教程。根据您的代码,这里有两种可能的变体:

<h2>DIV expands, X is at the top</h2>

<div style="display: flex; gap: 1em; flex-direction: row; flex-wrap: nowrap;">
    <div style="border:1px solid red; flex: 1 1 auto;">
        <h4>Random content here</h4>
        <p>Random content here</p>
        <div>Random content here</div>
    </div>

    <div style="border:1px solid red; flex: 0 0 auto;">
        X
    </div>
</div>

<h2>DIV does not expand, X is in the middle</h2>

<div style="display: flex; gap: 1em; flex-direction: row; flex-wrap: nowrap; align-items: center;">
    <div style="border:1px solid red; flex: 0 1 auto;">
        <h4>Random content here</h4>
        <p>Random content here</p>
        <div>Random content here</div>
    </div>

    <div style="border:1px solid red; flex: 0 0 auto;">
        X
    </div>
</div>

© www.soinside.com 2019 - 2024. All rights reserved.