我想只针对这个特定的句子(从$2.00/frame开始)在一个段落中应用CSS,它必须保持在同一行,但当使用其他元素时,它会跳过一行。
<p>Assorted frames made of different material, including MDF, birchwood, and PDE. Select frames can be sanded and painted according to your needs. Starting at $2.00 / frame.</p>
如有任何帮助,不胜感激。
也许你可以把它们放在span标签内,因为它是一个内联元素,不会改变整行的行为。然后,你可以选择任何你想要的span,或者在span上添加一个类,或者从该段落中选择它作为子段落。
它是如何有用的。
<p>Your text here <span class"special-text">Starting at $2.00 / frame.</span> more text </p>
.special-text{
your styling
}
或
p > .special-text{
your styling
}
只需在span
标签中包装您的目标元素并应用样式。
p .highlight {
color: red;
font-weight: bold;
}
<p>Assorted frames made of different material, including MDF, birchwood, and PDE. Select frames can be sanded and painted according to your needs. Starting at <span class="highlight"> $2.00 / frame. </span> </p>
[注]
请根据您的需要更改样式。