HTML 和 CSS:<ul> 和 <li> 标签代表什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11301870/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML and CSS: What do the <ul> and <li> tags stand for?
提问by Arthur Mamou-Mani
In the following lines of CSS code:
在以下 CSS 代码行中:
.sf-menu li:hover ul, .sf-menu li.sfHover ul {top: 40px!important; }
What do the HTML tags <ul>
and <li>
mean?
做什么的HTML标签<ul>
和<li>
意味着什么?
采纳答案by Guffa
They target <ul>
and <li>
elements in the page.
他们定位<ul>
和<li>
页面中的元素。
In CSS an id is prefixed by #
, a class is prefixed by .
, and an element has no prefix at all.
在 CSS 中,id 以 为前缀#
,类以 为前缀.
,元素根本没有前缀。
So the selector .sf-menu li:hover ul
will apply to any <ul>
element, inside an <li>
element that you are currently pointing at, inside an element with class="sf-menu"
.
因此,选择器.sf-menu li:hover ul
将应用于任何<ul>
元素,在<li>
您当前指向的元素内,在带有class="sf-menu"
.
The selector .sf-menu li.sfHover ul
will apply to any <ul>
element, inside an <li>
element with class="sfHover"
, inside an element with class="sf-menu"
.
选择器.sf-menu li.sfHover ul
将应用于任何<ul>
元素,在一个<li>
元素class="sfHover"
内,在一个元素内class="sf-menu"
。
回答by craig65535
It's from the HTML elements of the same name.
它来自同名的 HTML 元素。
UL - Unordered List (an ordered, or numbered, list would be OL)
LI - List Item
UL - 无序列表(有序或编号的列表将是 OL)
LI - 列表项
回答by tskuzzy
ul
stands for unordered list.
ul
代表无序列表。
li
stands for list item.
li
代表列表项。
They are the HTML tags for "bulleted" lists as opposed to "numbered" lists (which are specified by ol
for ordered list).
它们是“项目符号”列表的 HTML 标记,而不是“编号”列表(由ol
为有序列表指定)。