Using :before and :after CSS selector to insert HTML

HtmlCssCss Selectors

Html Problem Overview


I'm wondering if the following is possible. I know it doesn't work, but maybe I'm not writing it in the correct syntax.

li.first div.se_bizImg:before{
	content: "<h1>6 Businesses Found <span class="headingDetail">(view all)</span></h1>";
}

Any way of doing this?

Html Solutions


Solution 1 - Html

content doesn't support HTML, only text. You should probably use javascript, jQuery or something like that.

Another problem with your code is " inside a " block. You should mix ' and " (class='headingDetail').

If content did support HTML you could end up in an infinite loop where content is added inside content.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVikView Question on Stackoverflow
Solution 1 - HtmlErik MartinoView Answer on Stackoverflow