Html 如何在Elm中使用span环绕文本?
如何在Elm中编写以下标记Html 如何在Elm中使用span环绕文本?,html,elm,markup,Html,Elm,Markup,如何在Elm中编写以下标记 <p>Here is <span class="red">some text.</span></p> 这里是一些文本 这不完全是我想要的,但一种解决方案是在其他文本周围加上跨距 someText : Html Msg someText = p [] [ span [] [ text "Here is " ] , span [ class "red" ] [ text "some
<p>Here is <span class="red">some text.</span></p>
这里是一些文本
这不完全是我想要的,但一种解决方案是在其他文本周围加上跨距
someText : Html Msg
someText =
p []
[ span [] [ text "Here is " ]
, span [ class "red" ] [ text "some text." ]
]
您可以简单地执行以下操作:
p []
[ (text "hi there, ")
, span [] [ text "I'm a span" ]
]
这将创建HTML
<p>hi there, <span>I'm a span</span></p>
你好,我是斯潘
参见运行示例。确切答案似乎是前两个答案的一部分
someText : Html Msg
someText =
p []
[ text "Here is "
, span [ class "red" ] [ text "some text." ]
]
这里有一个很好的工具可以帮你做到这一点: