Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can <img> tag be within <a> tag? #85

Open
christosptr opened this issue Oct 22, 2021 · 3 comments
Open

Can <img> tag be within <a> tag? #85

christosptr opened this issue Oct 22, 2021 · 3 comments

Comments

@christosptr
Copy link

christosptr commented Oct 22, 2021

This website is amazing and looking to use it more as a reference

Please correct if I am wrong.
Based on the HTML standards I believe this is a valid HTML

<a href="default.asp">
   <img src="smiley.gif" alt="HTML tutorial">
</a>

When I check this I get a message "I doubt"
https://caninclude.glitch.me/can/include/?child=img&parent=a

is this something that can be updated?

Thank you!

@christosptr christosptr changed the title Can an <img> tag be with in an <a> tag? Can <img> tag be within <a> tag? Oct 22, 2021
@CyberLight
Copy link
Owner

CyberLight commented Oct 26, 2021

Hi, @christosptr ! Thank you for your feedback!

Since the content model of the <a/> tag is transparent, which means that to decide if the <img/> tag can be included in the <a/> tag, you need to look at the parent of the <a /> tag. For example:

<div>
    <a href="default.asp">
       <img src="smiley.gif" alt="HTML tutorial">
    </a>
</div>

We can include the <img /> tag inside the <div /> because the Flow Content matches https://caninclude.glitch.me/can/include/?child=img&parent=div

But the caninlude service has no information about the parent of the parent, in which case the service shows "I doubt" More context is needed to decide whether to include a tag in a tag in this case.

@christosptr
Copy link
Author

@CyberLight Thank you very much for the clarification.
Is there a way to check if tags are transarent or not and maybe provide this feedback so when some one check they can be pointed to the documentation or what to check?

@SelenIT
Copy link

SelenIT commented Dec 8, 2021

Can't Phrasing content be assumed as always allowed for nesting inside elements with Transparent content model? Are there any exceptions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants