html - CSS 应用于默认菜单

标签 html css sharepoint

我是 Sharepoint 的新手,他们给了我一个网站,我希望它看起来还不错,所以我去了 w3schools.com 尝试了一些基本代码。当我将其放入我的 Sharepoint 站点的内容编辑器中时,它运行良好,并在我放置它的位置显示栏。

问题是,它将它应用于所有菜单,甚至默认的共享点菜单 - 即插入 Webpart,所有编辑工具似乎都应用了 CSS。

如何将代码限制为仅特定的 Web 部件?

<!DOCTYPE html>
<html>

<head>
  <style>
    ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
      overflow: hidden;
      background-color: #333;
    }
    
    li {
      float: left;
      border-right: 1px solid #bbb;
    }
    
    li:last-child {
      border-right: none;
    }
    
    li a {
      display: block;
      color: white;
      text-align: center;
      padding: 14px 16px;
      text-decoration: none;
    }
    
    li a:hover:not(.active) {
      background-color: #111;
    }
    
    .active {
      background-color: #4CAF50;
    }
  </style>
</head>

<body>

  <ul>
    <li><a class="active" href="#home">Home</a></li>
    <li><a href="#news">News</a></li>
    <li><a href="#contact">Contact</a></li>
    <li style="float:right"><a href="#about">About</a></li>
  </ul>

</body>

</html>

最佳答案

只是为了扩展@Obsidian Age 所说的内容,样式需要像这样引用 ID

li#myID{}

然后它会将它应用到 id 为“myID”的 li 标签

li id="myID">

关于html - CSS 应用于默认菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47876844/

相关文章:

html - 如何对齐此复选框

html - 超出屏幕的内容不显示?

html - iPad 上的圆形搜索栏

html - 3D css 变换 div 覆盖忽略 z 坐标问题

python - 使用 Python3 更新 Sharepoint 2013

jquery - IE7 中的奇怪问题 仅在任何其他浏览器中没有

html - 子域忽略链接样式表的边距?

html - 如何在HTML div中显示css样式?

sharepoint - 我可以在 .net 3.5 sharepoint Web 部件中使用 .net 4.0 dll 程序集引用吗?

javascript - 没有正确使用 react 生命周期