Difference between DIV as-is and a SPAN with display:block

前端 未结 4 1339
夕颜
夕颜 2020-12-09 08:06

Is

different from in any way?

They render just fine the same. Any semantic difference b

4条回答
  •  旧巷少年郎
    2020-12-09 08:15

    Here's an example where it makes a real difference (for valid code, at least):

    
        The title of the image is also a link
        
    
    

    That allows you to make your span a block level element and allows the image and span to highlight together when moused over.

    A div would not be valid nested inside an a tag.

提交回复
热议问题