简体   繁体   English

CSS:ul标签使用不同的CSS代码吗?

[英]CSS: Different css code to ul tag?

I have this code: 我有以下代码:

 .sf-menu li:hover ul{
    left:           0;
    top:            34px; /* match top ul list item height */
    z-index:        99;
    width:auto;
height:300px;
    display:inline-block;
    overflow:hidden;
  -moz-column-count: 2;
  -webkit-column-count: 2;
  column-count: 2;
 -moz-column-width: auto;
  -webkit-column-width: auto;
  column-width: auto;

}
.sf-menu li.sfHover ul {
    left:           0;
    top:            34px; /* match top ul list item height */
    z-index:        99;
    width:auto;
height:auto;
    display:inline-block;
    overflow:hidden;
  -moz-column-count: 2;
  -webkit-column-count: 2;
  column-count: 2;
 -moz-column-width: auto;
  -webkit-column-width: auto;
  column-width: auto;   
}

so in the correspondent html, the tag <ul> is getting this css settings right, is it possible to use a tag like <ul2> and change the css for the part of the list using this tag? 因此,在相应的html中,标签<ul>正确地设置了该CSS,是否可以使用<ul2>这样的标签并使用该标签更改列表部分的CSS? I'm lost here, can you do that to the <ul> tag? 我在这里迷路了,您可以对<ul>标签执行此操作吗?

Creating a tag like <ul2> will not give you the expected results. 创建类似<ul2>的标签不会给您预期的结果。 The standard way to handle something like this is CSS classes. 处理此类问题的标准方法是CSS类。

Your tag in the HTML would be 您在HTML中的标记为

<ul class="second-ul">

and then you could declare a specific style withL 然后可以用L声明特定的样式

ul.second-ul {
    /*Put your style definition here*/
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM