CSS - nested anchor tag link

前端 未结 2 712
我在风中等你
我在风中等你 2021-01-29 02:30

I would like to create nested link inside a tag

Example:

This is a link sup text         


        
相关标签:
2条回答
  • 2021-01-29 03:10

    You can't have a tags inside another a tag because Nested Links are illegal

    You may use instead an <span> tag to make it work:

    <a href="#">This is a link <span id="sup">sup text</span> end of the link</a>
    
    0 讨论(0)
  • 2021-01-29 03:25

    Use a SPAN, since you cannot nest anchor tags.

    <a href="#">This is a link <span id="sup">sup text</span> end of the link</a>
    

    Ok I'll use span, but how to make the span having the same propreties than anchor tag when anchor tag is hover ?

    Add the hover state to your CSS for the "sup" element.

    a, a:hover #sup {
        font-family: Arial;
        color: #19578e;
        font-size: 10pt;
        font-weight: normal;
        font-style: normal;
        text-decoration: none;
    }
    

    If you have this in more than on place, you can simply use:

    a, a:hover span { ... }
    
    0 讨论(0)
提交回复
热议问题