是否可以将列表放在span标记中? [英] Is it possible to put a list inside a span tag?

查看:131
本文介绍了是否可以将列表放在span标记中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道< span> 标记是一个内联元素,而< li> 块元素。但是,我们有一个使用< span> 标记的工具提示,我们希望将工具提示中的文本放入列表中。但是,将< ul>< li> 放在span中并不能在所有浏览器中使用(且无效)。

I'm aware that <span> tag is an inline element while <li> is a block element. However, we have a tooltip that uses a <span> tag and we'd like to make the text inside that tooltip into a list. However, putting <ul><li> inside span doesn't work in all browsers (and it's invalid).

这是HTML代码:

<a class='tooltip'>Text<span>Text that we want to become a list</span></a>

有可能的工作吗?

推荐答案

虽然我不担心这个实例中的无效代码太多,考虑到你知道它,如果 ul li 打破一些代码,你可以做以下,也可能是无效的:

Although I would not worry to much about invalid code in this instance, given that you know about it, if the ul li is breaking in some of the code, you could do the following, which is also probably invalid:

<a class='tooltip'>Text<span>List item 1<br />
                             List item 2<br />
                             List item 3</span></a>

这篇关于是否可以将列表放在span标记中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆