首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在使用多个无序列表时删除列表项的最后一个子项的右边框。

如何在使用多个无序列表时删除列表项的最后一个子项的右边框。
EN

Stack Overflow用户
提问于 2016-11-27 15:16:45
回答 1查看 679关注 0票数 0

我想删除最后一个子边框-对一个列表的元素如下所示,我试图用不同的类型来删除它,但没有为此工作,请帮助我解决这个问题。

代码语言:javascript
复制
<header>
  <div id="tag" >
    <ul id="menu-item" class="nav">
       <li id="item-1" class="item-type"> <a href="index.html"> Home </a</li>
       <li id="item-2" class="item-type"> <a href="about.html"> About Me </a></li>
       <li id="item-3" class="item-type"> <a href="contact.html"> Contact </a> </li>
       <li id="item-4" class="item-type"> <a href="map.html"> Map </a> </li>
    </ul>
 </div>
 <div id="head">
   <ul id="ul-head">
      <li id="head-1" > <a href="/"> <img id="profile" src="Images/display.jpg" alt="profile" width="80px" height="80px" /> </a> </li>
      <li id="head-2" class="head-item"> TECHNOLOGIES </li>
      <li id="head-3" class="head-item"> RESUME </li>
      <li id="head-4" class="head-item"> FUTURE SCOPE </li>
      <li id="head-5" class="head-item"> INTEREST </li>
    </ul>
  </div>
</header>

应用CSS如下:

代码语言:javascript
复制
#menu-item {
   position: absolute;
   display: block;
   list-style-type: none;
   float: right;
   left: 850px;
   padding: 9px 10px 9px 10px;
   text-align: center;
   margin: 0px
 }
#menu-item > li {
     float: left;
     display: inline;
     border-left: 1px solid #fff ;
      padding: 1px 15px 1px 15px;
    }
.item-type a {
      color: #FFFFFF;
      text-decoration: none;
   }

#head #ul-head #head-1 a #profile {
        position: absolute;
        border-radius: 50%;
        display: inline;
        left: 140px;
        top: 0px
    }

.head-item {
         position: relative;
         font-size: 16px;
         font-family: Arial;
         font-weight: bold;
         left: 230px;
         top: 15px;
         color: #778899;
      }
#ul-head > li {
          float: left;
          display: inline;
          border-right: 1px solid #000000;
          padding: 1px 25px 1px 25px;
          text-align: center;
     }
#tag #menu-item li:first-child a {
        border-left: none;
     }
#head #ul-head li:last-child a {
         border-right: none;
     }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-27 15:20:47

<a> #ul-head列表中没有标记

因此,您需要将代码更改为:

代码语言:javascript
复制
#head #ul-head li:last-child{
         border-right: none;
     }

对于列表#菜单项的条目,在li标记上使用边框,所以您的css代码应该如下所示:

代码语言:javascript
复制
#tag #menu-item li:first-child{
        border-left: none;
     }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40830466

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档