How to target specific text content in a paragraph which contains multiple line breaks?

你。 提交于 2020-08-11 07:32:38

问题


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

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>

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

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

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

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

Thanks!


回答1:


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>

Then apply your CSS like this

#snippet{
//css styles go here
}


来源:https://stackoverflow.com/questions/30924044/how-to-target-specific-text-content-in-a-paragraph-which-contains-multiple-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!