如何针对包含多个换行符的段落中的特定文本内容? [英] How to target specific text content in a paragraph which contains multiple line breaks?

查看:122
本文介绍了如何针对包含多个换行符的段落中的特定文本内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这是我一无所知的奇怪事情.

So here is the weird thing I am clueless on..

下面是HTML的示例代码段,

Below is the sample snippet of the HTML,

<p>This is a paragraph with <br><br> two weird line breaks <br><br> and that too TWICE!</p>

现在的问题是,我想将CSS应用于文本This is paragraph或第一个双行换行符之后的内容.

Now the issue is, I want to apply CSS to the text This is paragraph OR the content after first-double line breaks.

我尝试了br + br或第n个选择器,这是我能想到的所有CSS选择器,但没有成功.

I tried br + br or nth-selectors, all css selectors I could think of, but it didn't worked out.

棘手的是,我不想用javascript来做,否则我会很容易伴随复杂性"来完成它.

Tricky part is, I do not want to do by javascript, or else I would have done it easily accompanied by 'complexity'.

仅CSS可以提示或解决此问题!

Any hints or solution to this problem by CSS ONLY!!

谢谢!

推荐答案

您可以通过添加HTML来做到这一点.我认为没有CSS特定的方式可以做到这一点.

You could do this by adding in HTML. I dont think there is a CSS specific way to do this.

<p><span id="snippet">This is a paragraph with </span><br><br> two weird line breaks <br><br> and that too TWICE!</p>

然后像这样应用您的CSS

Then apply your CSS like this

#snippet{
//css styles go here
}

这篇关于如何针对包含多个换行符的段落中的特定文本内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆