'In a div containing 3 paragraphs can I use CSS Pseudo-elements like after and before to change the p tag to the span tag
<div id="titles">
<p> title1</p>
<p> title2</p>
<p> title3</p>
</div>
div title is our container here the 3 paragraphs inside need to be replaced with the span tag is that possible doing this with only html and css
Solution 1:[1]
No. You cannot change a tag using CSS. You can change the behaviour, like display:inline for the Ps or display:block for the SPANs
#titles p {
display: inline;
}
#spans span {
display: block;
}
<div id="titles">
<p>title1</p>
<p>title2</p>
<p>title3</p>
</div>
<hr/>
<div id="spans">
<span>title1</span>
<span>title2</span>
<span>title3</span>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mplungjan |
