Html 造型与设计;拉阔;内跨

Html 造型与设计;拉阔;内跨,html,css,Html,Css,假设我的跨度如下所示: <span> This is my string &raquo; and it continues </span> 这是我的字符串»;它还在继续 我希望跨距内的字体颜色是黑色,除了»我希望它是红色 这样做的好方法是什么 谢谢最好的HTML/CSS方式是 <span> This is my string <span>&raquo;</span> and it continues &l

假设我的跨度如下所示:

<span> This is my string &raquo;  and it continues </span>
这是我的字符串»;它还在继续
我希望跨距内的字体颜色是黑色,除了»我希望它是红色

这样做的好方法是什么


谢谢

最好的HTML/CSS方式是

<span> This is my string <span>&raquo;</span> and it continues </span>
用另一个
标签将其包装起来。 最好的方法是用另一个
标记将其包装如下:

<span> This is my string <span class="r">&raquo;</span>  and it continues </span>
span span.r {color: red;}

您可以尝试包装
»并设置该元素的样式

html:

<span> This is my string <em>&raquo;</em> and it continues</span>
span { color: #000000; }
span em { color: #ff0000; font-style: normal; }

为什么滥用这里的
是表示强调的语义元素。这听起来不像OP想要的,特别是因为你通常强调内容,而不是排版。OP没有给出上下文,因此可能是完全合适的-我们没有足够的信息来判断你的虐待指控。我在HTML中看到的更常见的错误是使用and而不是适当的语义元素。使用不同的颜色是强调,不是吗?我本可以在这里使用
,但使用了较短的标记。