+ 3
HTML : why cant i use link feature inside the table tag ? the <a href="#"> <td>abc</td></a>
24 Réponses
+ 7
Because <td> as the table cell can contain other tags. But on the other hand, <a> can only contain the hyperlink text, nothing more ...
+ 3
You should've enclosed the <a> within the <td>
<td><a href="#">abc</a><td>
+ 3
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>
+ 3
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
+ 3
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.
+ 3
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.
+ 2
Ohh got ittt . Thank you
+ 2
No problem 👌
+ 2
Amav Kumar,
Except for an <img> I hardly see anyone put in other HTML in a hyperlink.
+ 2
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?
+ 2
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
+ 2
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.
+ 2
Ipang Arnav Kumar friends chill
+ 1
Ipang btw <a> tag can contain other html elements
+ 1
Arnav Kumar thanks :)
+ 1
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
+ 1
Arnav Kumar the hacking part makes sense.
+ 1
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
+ 1
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..
+ 1
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)