如何从下拉菜单中删除空格?

时间:2017-10-24 17:28:31

标签: html css

我是高中的高级网页编辑,根据管理员的要求,我们正在开设一个新网站。我需要删除我放在网站上的下拉菜单周围的白色边框。



h1 {
  border-top: none;
  border-left: none;
  border-bottom: 5px groove red;
  border-right: none;
  color: #e60000;
  font-family: century gothic;
  text-align: center;
  color: #FF000;
}

h2 {
  font-family: century gothic;
}

h3 {
  font-family: century gothic;
}

h5 {
  font-family: californian fb;
  font-szie: 1.15em;
}

p {
  border-top: none;
  border-left: none;
  border-bottom: none;
  border-right: none;
  font-family: californian fb;
  font-size: 1.15em;
}

table#sitelinks td {
  font-size: 1.15em;
}

table#sitelinks tr:nth-child(odd) {
  background-color: #fff
}

table tr:nth-child(even) {
  background-color: #fff
}

table tr:nth-child(odd) {
  background-color: #eee
}

hr {
  border-top: none;
  border-left: none;
  border-bottom: 5px groove red;
  border-right: none;
  font-family: californian fb;
  font-size: 1.15em;
}

th {
  text-align: left;
  font-family: century gothic;
  padding: 10px 0px 0px 0px;
  font-size: 1.15em;
}

td {
  font-family: century gothic;
  border: 1px solid black;
  padding: 5px 5px 5px 5px;
  text-align: center;
  font-size: 1em;
}

.center {
  text-align: center;
}

.blue {
  color: blue;
}

.bottomborder {
  text-align: center;
  border-bottom: 5px groove red;
}

a:link {
  color: #e60000;
  text-decoration: none
}

a:visited {
  color: #e60000;
  text-decoration: none
}

a:hover {
  color: #e60000;
  text-decoration: none
}

a:active {
  color: #e60000;
  text-decoration: none
}

a {
  display: block;
  text-decoration: none;
  width: 100%;
  height: 100%;
  color: #999;
}

a:hover {
  color: #FF0000;
}


/* NAVIGATION */

.navigation {
  list-style: none;
  padding: 0;
  width: 250px;
  height: 40px;
  margin: 10px auto;
  background: #FF0000;
}

.navigation,
.navigation a.main {
  border-radius: 4px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
}

.navigation:hover,
.navigation:hover a.main {
  border-radius: 4px 4px 0 0;
  -webkit-border-radius: 4px 4px 0 0;
  -moz-border-radius: 4px 4px 0 0;
}

.navigation a.main {
  display: block;
  height: 40px;
  font: bold 15px/40px arial, sans-serif;
  text-align: center;
  text-decoration: none;
  color: #FFF;
  -webkit-transition: 0.2s ease-in-out;
  -o-transition: 0.2s ease-in-out;
  transition: 0.2s ease-in-out;
}

.navigation:hover a.main {
  color: rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.04);
}

.navigation li {
  width: 250px;
  height: 40px;
  background: #F7F7F7;
  font: normal 12px/40px arial, sans-serif !important;
  color: #999;
  text-align: center;
  margin: 0;
  -webkit-transform-origin: 50% 0%;
  -o-transform-origin: 50% 0%;
  transform-origin: 50% 0%;
  -webkit-transform: perspective(350px) rotateX(-90deg);
  -o-transform: perspective(350px) rotateX(-90deg);
  transform: perspective(350px) rotateX(-90deg);
  box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
  -webkit-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
  -moz-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
}

.navigation li:nth-child(even) {
  background: #F5F5F5;
}

.navigation li:nth-child(odd) {
  background: #EFEFEF;
}

.navigation li.n1 {
  -webkit-transition: 0.2s linear 0.4s;
  -o-transition: 0.2s linear 0.4s;
  transition: 0.2s linear 0.4s;
}

.navigation li.n2 {
  -webkit-transition: 0.2s linear 0.3s;
  -o-transition: 0.2s linear 0.3s;
  transition: 0.2s linear 0.3s;
}

.navigation li.n3 {
  -webkit-transition: 0.2s linear 0.2s;
  -o-transition: 0.2s linear 0.2s;
  transition: 0.2s linear 0.2s;
}

.navigation li.n4 {
  -webkit-transition: 0.2s linear 0.1s;
  -o-transition: 0.2s linear 0.1s;
  transition: 0.2s linear 0.1s;
}

.navigation li.n5 {
  border-radius: 0px 0px 4px 4px;
  -webkit-transition: 0.2s linear 0s;
  -o-transition: 0.2s linear 0s;
  transition: 0.2s linear 0s;
}

.navigation:hover li {
  -webkit-transform: perspective(350px) rotateX(0deg);
  -o-transform: perspective(350px) rotateX(0deg);
  transform: perspective(350px) rotateX(0deg);
  -webkit-transition: 0.2s linear 0s;
  -o-transition: 0.2s linear 0s;
  transition: 0.2s linear 0s;
}

.navigation:hover .n2 {
  -webkit-transition-delay: 0.1s;
  -o-transition-delay: 0.1s;
  transition-delay: 0.1s;
}

.navigation:hover .n3 {
  -webkit-transition-delay: 0.2s;
  -o-transition-delay: 0.2s;
  transition-delay: 0.2s;
}

.navigation:hover .n4 {
  transition-delay: 0.3s;
  -o-transition-delay: 0.3s;
  transition-delay: 0.3s;
}

.navigation:hover .n5 {
  -webkit-transition-delay: 0.4s;
  -o-transition-delay: 0.4s;
  transition-delay: 0.4s;
}

<html>

<head>
  <link rel="shortcut icon" href="images\pantherpaw.png" type="image/x-icon">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
  <link rel="stylesheet" type="text/css" href="stiglerstylesheet.css" />
</head>

<body style="background-color:black;color:white;padding:5px;" font="century gothic">

  <div align="center">
    <img src="images\websitelogoother2.png" alt="Stigler Public Schools" style="width:50%;" align="middle">
    <table>
      <tr>
        <td>
          <ul class="navigation">
            <a class="main" href="#url">Navigation #1</a>
            <li class="n1"><a href="#">item #1</a></li>
            <li class="n2"><a href="#">item #2</a></li>
            <li class="n3"><a href="#">item #3</a></li>
            <li class="n4"><a href="#">item #4</a></li>
            <li class="n5"><a href="#">item #5</a></li>
          </ul>
        </td>
        <td>
          <ul class="navigation">
            <a class="main" href="#url">Navigation #2</a>
            <li class="n1"><a href="#">item #1</a></li>
            <li class="n2"><a href="#">item #2</a></li>
            <li class="n3"><a href="#">item #3</a></li>
            <li class="n4"><a href="#">item #4</a></li>
            <li class="n5"><a href="#">item #5</a></li>
          </ul>

        </td>
        <td>
          <ul class="navigation">
            <a class="main" href="#url">Navigation #3</a>
            <li class="n1"><a href="#">item #1</a></li>
            <li class="n2"><a href="#">item #2</a></li>
            <li class="n3"><a href="#">item #3</a></li>
            <li class="n4"><a href="#">item #4</a></li>
            <li class="n5"><a href="#">item #5</a></li>
          </ul>

        </td>
      </tr>
    </table>
</body>

</html>
&#13;
&#13;
&#13;

Here is the result

我需要删除下拉菜单周围的空白区域,谢谢。

2 个答案:

答案 0 :(得分:0)

一个明智的技巧是删除这个css部分

 table tr:nth-child(odd) {
   background-color: #eee; 
}

&#13;
&#13;
h1 {
  border-top: none;
  border-left: none;
  border-bottom: 5px groove red;
  border-right: none;
  color: #e60000;
  font-family: century gothic;
  text-align: center;
  color: #FF000;
}

h2 {
  font-family: century gothic;
}

h3 {
  font-family: century gothic;
}

h5 {
  font-family: californian fb;
  font-szie: 1.15em;
}

p {
  border-top: none;
  border-left: none;
  border-bottom: none;
  border-right: none;
  font-family: californian fb;
  font-size: 1.15em;
}

table#sitelinks td {
  font-size: 1.15em;
}

table#sitelinks tr:nth-child(odd) {
  background-color: #fff
}

table tr:nth-child(even) {
  background-color: #fff
}

/*table tr:nth-child(odd) {
  background-color: #eee
}*/

hr {
  border-top: none;
  border-left: none;
  border-bottom: 5px groove red;
  border-right: none;
  font-family: californian fb;
  font-size: 1.15em;
}

th {
  text-align: left;
  font-family: century gothic;
  padding: 10px 0px 0px 0px;
  font-size: 1.15em;
}

td {
  font-family: century gothic;
  border: 1px solid black;
  padding: 5px 5px 5px 5px;
  text-align: center;
  font-size: 1em;
}

.center {
  text-align: center;
}

.blue {
  color: blue;
}

.bottomborder {
  text-align: center;
  border-bottom: 5px groove red;
}

a:link {
  color: #e60000;
  text-decoration: none
}

a:visited {
  color: #e60000;
  text-decoration: none
}

a:hover {
  color: #e60000;
  text-decoration: none
}

a:active {
  color: #e60000;
  text-decoration: none
}

a {
  display: block;
  text-decoration: none;
  width: 100%;
  height: 100%;
  color: #999;
}

a:hover {
  color: #FF0000;
}


/* NAVIGATION */

.navigation {
  list-style: none;
  padding: 0;
  width: 250px;
  height: 40px;
  margin: 10px auto;
  background: #FF0000;
}

.navigation,
.navigation a.main {
  border-radius: 4px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
}

.navigation:hover,
.navigation:hover a.main {
  border-radius: 4px 4px 0 0;
  -webkit-border-radius: 4px 4px 0 0;
  -moz-border-radius: 4px 4px 0 0;
}

.navigation a.main {
  display: block;
  height: 40px;
  font: bold 15px/40px arial, sans-serif;
  text-align: center;
  text-decoration: none;
  color: #FFF;
  -webkit-transition: 0.2s ease-in-out;
  -o-transition: 0.2s ease-in-out;
  transition: 0.2s ease-in-out;
}

.navigation:hover a.main {
  color: rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.04);
}

.navigation li {
  width: 250px;
  height: 40px;
  background: #F7F7F7;
  font: normal 12px/40px arial, sans-serif !important;
  color: #999;
  text-align: center;
  margin: 0;
  -webkit-transform-origin: 50% 0%;
  -o-transform-origin: 50% 0%;
  transform-origin: 50% 0%;
  -webkit-transform: perspective(350px) rotateX(-90deg);
  -o-transform: perspective(350px) rotateX(-90deg);
  transform: perspective(350px) rotateX(-90deg);
  box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
  -webkit-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
  -moz-box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.05);
}

.navigation li:nth-child(even) {
  background: #F5F5F5;
}

.navigation li:nth-child(odd) {
  background: #EFEFEF;
}

.navigation li.n1 {
  -webkit-transition: 0.2s linear 0.4s;
  -o-transition: 0.2s linear 0.4s;
  transition: 0.2s linear 0.4s;
}

.navigation li.n2 {
  -webkit-transition: 0.2s linear 0.3s;
  -o-transition: 0.2s linear 0.3s;
  transition: 0.2s linear 0.3s;
}

.navigation li.n3 {
  -webkit-transition: 0.2s linear 0.2s;
  -o-transition: 0.2s linear 0.2s;
  transition: 0.2s linear 0.2s;
}

.navigation li.n4 {
  -webkit-transition: 0.2s linear 0.1s;
  -o-transition: 0.2s linear 0.1s;
  transition: 0.2s linear 0.1s;
}

.navigation li.n5 {
  border-radius: 0px 0px 4px 4px;
  -webkit-transition: 0.2s linear 0s;
  -o-transition: 0.2s linear 0s;
  transition: 0.2s linear 0s;
}

.navigation:hover li {
  -webkit-transform: perspective(350px) rotateX(0deg);
  -o-transform: perspective(350px) rotateX(0deg);
  transform: perspective(350px) rotateX(0deg);
  -webkit-transition: 0.2s linear 0s;
  -o-transition: 0.2s linear 0s;
  transition: 0.2s linear 0s;
}

.navigation:hover .n2 {
  -webkit-transition-delay: 0.1s;
  -o-transition-delay: 0.1s;
  transition-delay: 0.1s;
}

.navigation:hover .n3 {
  -webkit-transition-delay: 0.2s;
  -o-transition-delay: 0.2s;
  transition-delay: 0.2s;
}

.navigation:hover .n4 {
  transition-delay: 0.3s;
  -o-transition-delay: 0.3s;
  transition-delay: 0.3s;
}

.navigation:hover .n5 {
  -webkit-transition-delay: 0.4s;
  -o-transition-delay: 0.4s;
  transition-delay: 0.4s;
}
&#13;
<html>

<head>
  <link rel="shortcut icon" href="images\pantherpaw.png" type="image/x-icon">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
  <link rel="stylesheet" type="text/css" href="stiglerstylesheet.css" />
</head>

<body style="background-color:black;color:white;padding:5px;" font="century gothic">

  <div align="center">
    <img src="images\websitelogoother2.png" alt="Stigler Public Schools" style="width:50%;" align="middle">
    <table>
      <tr>
        <td>
          <ul class="navigation">
            <a class="main" href="#url">Navigation #1</a>
            <li class="n1"><a href="#">item #1</a></li>
            <li class="n2"><a href="#">item #2</a></li>
            <li class="n3"><a href="#">item #3</a></li>
            <li class="n4"><a href="#">item #4</a></li>
            <li class="n5"><a href="#">item #5</a></li>
          </ul>
        </td>
        <td>
          <ul class="navigation">
            <a class="main" href="#url">Navigation #2</a>
            <li class="n1"><a href="#">item #1</a></li>
            <li class="n2"><a href="#">item #2</a></li>
            <li class="n3"><a href="#">item #3</a></li>
            <li class="n4"><a href="#">item #4</a></li>
            <li class="n5"><a href="#">item #5</a></li>
          </ul>

        </td>
        <td>
          <ul class="navigation">
            <a class="main" href="#url">Navigation #3</a>
            <li class="n1"><a href="#">item #1</a></li>
            <li class="n2"><a href="#">item #2</a></li>
            <li class="n3"><a href="#">item #3</a></li>
            <li class="n4"><a href="#">item #4</a></li>
            <li class="n5"><a href="#">item #5</a></li>
          </ul>

        </td>
      </tr>
    </table>
</body>

</html>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

我在导航类中更改了边距,以删除10px并删除背景颜色。我将所需的背景颜色应用于 td ,因为某些空白是由表格单元格生成的cellfeding。我还删除了填充,因为它使您的下拉菜单看起来更小。

<div class="container">
    <div class="row">
        <div class="col-sm-3"></div>
        <div class="col-sm-9">
            <form>
                <div class="form-group row">
                    <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label>
                    <div class="col-sm-10">
                        <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

注意 - 你的html部分在我的编辑器中突出显示,一些拼写错误的样式和顽皮的html和css在那里。我建议使用一个编辑器,它会警告你顽皮的代码。