Here's the HTML code I need help with:
<style>
.ad { margin: 15px; height: 30px; background-color: #7f7f7f; }
.article { width: 300px; font-size: 24px; line-height: 30px; border: 1px solid; }
</style>
<div class="ad"></div>
<div class="article">
asd asd asd asd asd asd asd asd
asd asd asd asd asd asd asd asd
asd asd asd asd asd asd asd asd
asd asd asd asd asd asd asd asd
asd asd asd asd asd asd asd asd
asd asd asd asd asd asd asd asd
asd asd asd asd asd asd asd asd
asd asd asd asd asd asd asd asd
</div>
I'm looking to insert an advertisement within the article, specifically between the 3rd and 4th lines. Is it possible to achieve this using CSS alone? If not, are there alternatives like JavaScript or PHP that could help accomplish this task? The article content is stored as a string in PHP, making it challenging to pinpoint the exact location of the 3rd line.
Note that the article contains HTML tags, ruling out character counting as a solution. Additionally, the placement of the .ad tag relative to the .article tag can vary.
Your assistance in resolving this dilemma would be greatly appreciated. Thank you!