< li> HTML中的标签有结尾标签? [英] Does the <li> tag in HTML have an ending tag?

查看:437
本文介绍了< li> HTML中的标签有结尾标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在大学时学习了HTML中的列表,并且教授表示< li> 没有结束标记< / li> 以及其他一些标签,如< img> < br> 。这是否正确?因为我在最后看到很多使用标签的模板/主题,许多网站也告诉你< / li> 存在,所以我不知道该相信谁,以及使用< li>



的正确方法。为什么我问这是因为上次我们了解到< img> 标签,他说 alt =属性为您提供了一个显示在图片上的文本,当我在这里问他时,这只是替代破碎图片的文本,这也让我很想知道这一点。 p>

谢谢。 li 元素有一个结束标记(< / li> ),但它是optio nal

lockquote
li 元素的结束标签可能如果 li 元素之后紧跟着另一个 li 元素,或者父元素中没有更多内容。


So, I was learning about lists in HTML at college and the professor said <li> doesn't have an ending tag </li> along with some other tags like <img> and <br>. Is that correct or not? Because I've seen a lot of templates / themes using tag at the end, as well many sites also teach you that </li> exists, so I'm not sure whom to believe and what is correct way of using <li>?

The reason why I'm asking this is because last time we learned about <img> tag, he said that the alt="" attribute gives you a text displayed over the image when you hover the mouse, which turned it's only alternative text for broken images when I asked here and he was wrong for that case, which also made me wonder this as well.

Thanks.

解决方案

The li element has an end tag (</li>), but it’s optional in some cases:

An li element's end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.

这篇关于&lt; li&gt; HTML中的标签有结尾标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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