XHTML - What elements are allowed within the element?

后端 未结 5 1524
失恋的感觉
失恋的感觉 2020-12-18 19:33

I know span strong and em. Are there any others? I\'m trying to filter a text which goes inside a link, and need to know what elements

相关标签:
5条回答
  • 2020-12-18 19:45

    It is worth to mention that "block-level links" are valid in HTML5.

    0 讨论(0)
  • 2020-12-18 19:48

    Other inline tags should be legal inside <a> like <img>, <abbr>, etc. Here's alist of all the inline tags:

    http://en.wikipedia.org/wiki/Inline_tag#Inline_elements

    Also, since <a> is a body tag, inline body tags only inside it, please.

    0 讨论(0)
  • According to the DTD, lots of elements:

    br | span | bdo | map
    object | img | tt | i | b | big | small 
    ins | del | script | input | select | textarea | label | button
    em | strong | dfn | code | q |
                   samp | kbd | var | cite | abbr | acronym | sub | sup 
    
    0 讨论(0)
  • 2020-12-18 19:52

    For HTML 4.01 Transitional, for instance, you can pick the DTD from w3c site. Then search the <!ELEMENT A in the document and navigate the entities, like %inline; to know the allowed nested elements.

    • #PCDATA is allowed.
    • Through %inline; and %fontstyle;: TT | I | B | U | S | STRIKE | BIG | SMALL
    • Through %inline; and %pharse;: EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE | ABBR | ACRONYM
    • ...and so on

    They will, in turn, have other nested elements.

    You can repeat the operation for other HTML DTDs.

    To know how DTDs nesting rules work, I suggest to read a tutorial.

    0 讨论(0)
  • 2020-12-18 19:53

    If you're using XHTML transitional, then font, b, i, sub, sup....AFAIK just about any inline tag (except for another link) will fit.

    0 讨论(0)
提交回复
热议问题