I was wondering if we could add a span tag inside a tag....
<h2 style="text-align: left;"><a href="mydomain.com"><span style="font-weight: bold;">Dog dresses</span></a><br></h2>
Is the above method right? Is it safe to use...???
I know that We can define some class here and let it go inside other elements like this.
<h2><a href="mydomain" class="bold">Dog dresses</a></h2> .bold {font-weight: bold; }
OR
<h2 class="bold"><a href="mydomain">Dog dresses</a></h2> h2.bold a { font-weight: bold; }
Please share your views..
SPAN is a GENERIC inline container. It does not matter whether an a is inside span or span is inside a as both are inline elements.
Yes, it is valid to have a <span> tag as the content of an <i> tag.
Yes, it's typically fine to use a span inside of an h1 . span is an inline element, so it's typically okay to use it inside anything (that allows elements inside it!)
The span tag is just like a div, which is used to group similar content so it can all be styled together. But span is different in that it is an inline element, as opposed to div , which is a block element.
Yes, it's fine. <span>
is an inline element. Unless you add the css display: block;
to it, it can go in the <a>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With