24 AnswersNew Answer
24 AnswersNew Answer
Because <td> as the table cell can contain other tags. But on the other hand, <a> can only contain the hyperlink text, nothing more ...
You should've enclosed the <a> within the <td> <td><a href="#">abc</a><td>
Thank you , it worked. But why do we have to do it like that? Why doesn't it work when <td> is enclosed inside <a>
Its not that <a> tag can't contain other html elements The fact is that <tr> only accept <td> elements as its children Not other html elements like <a> etc. If i am wrong somewhere correct me
Arnav Kumar That is exactly what I mean. You only read it and translate it as is. My words were a discouragement, for the misuse, or may I say, *abuse* of hyperlink from its original purpose. And it is because I don't want the beginners out there (who happen to see this) to try and do what those "hackers" do, in a thought it was justifiable.
Arnav Kumar Don't say that man please ... You mentioned the black hole thing too remember? I'm not gonna change my original comment. Let those who visit this thread later see the whole thing, and know my true intention why I wrote it that way.
Ohh got ittt . Thank you
No problem 👌
Amav Kumar, Except for an <img> I hardly see anyone put in other HTML in a hyperlink.
Arnav Kumar I know you're great with the web stuffs. But you read my statement only from your view. But then you freely judge that I'm one of those who needs to see to believe. Who are you to judge me man?
Ipang I just replied to your these words "But on the other hand, <a> can only contain the hyperlink text, nothing more ..." You said nothing more but now you are atleast saying it can take in images so isn't it be a bit misleading and confusing to a beginner out there
Arnav Kumar I thank you for your comment. It opens a new point of view for those who reads my comment. If they too misunderstood it, then they get to see my original intention.
Ipang Arnav Kumar friends chill
Ipang btw <a> tag can contain other html elements
Arnav Kumar thanks :)
Ipang if i have never seen a black hole that doesn't mean that it doesn't exist I have seen people wrapping whole <body> content in <a> tag Especially hackers that want to take user to another site wherever they click on the screen I myself tried wrapping other elements in <a> and it works
Arnav Kumar the hacking part makes sense.
Ipang There's so many good cases too Like Google wraps search results in links so that wherever user clicks on that area, the link gets opened but if they only wrap text in link then there maybe accessibility problems Other uses would be wrapping a div that is a profile card will take to that profile
Arnav Kumar I hope your argument still relates to the original problem, where a <td> enclosed in <a> doesn't work. Otherwise the "good cases" list can go on infinitely..
Ipang btw your that comment was already there before i did a comment And that hacker one was just an example nothing more than that And imagine if i hadn't commented then whole time Lo0pZz would had been thinking that he can only use texts inside <a> tag not anything more (until he figures out on his on)
Sololearn Inc.4 Embarcadero Center, Suite 1455
Send us a message