Bootstrap药丸含量不会消失

时间:2018-05-05 22:25:31

标签: javascript html css twitter-bootstrap

我正在使用bootstrap的药丸导航栏,出于某种原因,一旦我添加了包含具有netflix感觉的瓷砖的代码(在STEMuli标签上),导航栏将不再删除内容标签。它实际上将在下面直接添加下一个选项卡信息。我以为我错过了一些div标签,但是我拿走了一些代码并重建它以进行双重检查,div标签结帐。我不确定是什么原因引起的?因为我删除了我的" STEMuli"实际代码中的选项卡,只需添加一些纯文本就可以了,即使我添加了一行...我被卡住了请帮忙!



.popover-header{
  color:#000000;
}
#row{
  overflow: hidden;
}
.logo{
  z-index:0;
}

.row {
  overflow: scroll;
  width: 100%;
  z-index: 1;
}
.row__inner {
  -webkit-transition: 450ms -webkit-transform;
  transition: 450ms -webkit-transform;
  transition: 450ms transform;
  transition: 450ms transform, 450ms -webkit-transform;
  font-size: 0;
  white-space: nowrap;
  margin: 50px 0;
  padding-bottom: 30px;
  padding-bottom: 30px;
}
.tile {
  position: relative;
  display: inline-block;
  width: 250px;
  height: 250px;
  margin-right: 10px;
  margin-left: 50px;
  font-size: 20px;
  cursor: pointer;
  -webkit-transition: 450ms all;
  transition: 450ms all;
  -webkit-transform-origin: center left;
          transform-origin: center left;
}
.tile__img {
  width: 250px;
  height: 250px;
  -o-object-fit: cover;
     object-fit: cover;
}
.tile__details {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  font-size: 10px;
  opacity: 0;
  background: -webkit-gradient(linear, left bottom, left top, from(rgba(0,0,0,0.9)), to(rgba(0,0,0,0)));
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
  -webkit-transition: 450ms opacity;
  transition: 450ms opacity;
}
.tile__details:after,
.tile__details:before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  display: #000;
}

.tile__details:before {
  left: 0;
  width: 100%;
  font-size: 30px;
  margin-left: 7px;
  margin-top: -18px;
  text-align: center;
  z-index: 2;
}
.tile:hover .tile__details {
  opacity: 1;
}
.tile__title {
  position: absolute;
  bottom: 0;
  padding: 10px;
}
.row__inner:hover {
  -webkit-transform: translate3d(-62.5px, 0, 0);
          transform: translate3d(-62.5px, 0, 0);
}
.row__inner:hover .tile {
  opacity: 0.3;
}
.row__inner:hover .tile:hover {
  -webkit-transform: scale(1.5);
          transform: scale(1.5);
  opacity: 1;
}
.tile:hover ~ .tile {
  -webkit-transform: translate3d(125px, 0, 0);
          transform: translate3d(125px, 0, 0);
}
a:hover{
  color: #F1D302;
}
.checkbox-wrapper {
    height: 13px;
    width: 13px;
}
.btn{
  background-color: #F1D302;
}
body {
  font-family: 'Rubik', sans-serif;

}
.card-img-top {
    height: 300px;
    width: 100%;
}

.btn-xlong {
    padding: 10px 50px;
    font-size: 22px;
    line-height: normal;
    -webkit-border-radius: 10px;
       -moz-border-radius: 10px;
            border-radius: 10px;
}
.steps-form-3 {
  width: 2px;
  height: 470px;
  position: relative; }
  .steps-form-3 .steps-row-3 {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
    flex-direction: column; }
    .steps-form-3 .steps-row-3:before {
      top: 14px;
      bottom: 0;
      position: absolute;
      content: "";
      width: 2px;
      height: 100%;
      background-color: #7283a7; }
    .steps-form-3 .steps-row-3 .steps-step-3 {
      height: 150px;
      display: -webkit-box;
      display: -webkit-flex;
      display: -ms-flexbox;
      display: flex;
      text-align: center;
      position: relative; }
      .steps-form-3 .steps-row-3 .steps-step-3.no-height {
        height: 50px; }
      .steps-form-3 .steps-row-3 .steps-step-3 p {
        margin-top: 0.5rem; }
      .steps-form-3 .steps-row-3 .steps-step-3 button[disabled] {
        opacity: 1 !important;
        filter: alpha(opacity=100) !important; }
      .steps-form-3 .steps-row-3 .steps-step-3 .btn-circle-3 {
        width: 60px;
        height: 60px;
        border: 2px solid #59698D;
        background-color: white !important;
        color: #59698D !important;
        border-radius: 50%;
        padding: 18px 18px 15px 15px;
        margin-top: -22px; }
        .steps-form-3 .steps-row-3 .steps-step-3 .btn-circle-3:hover {
          border: 2px solid #4285F4;
          color: #4285F4 !important;
          background-color: white !important; }
        .steps-form-3 .steps-row-3 .steps-step-3 .btn-circle-3 .fa {
          font-size: 1.7rem; }
::-webkit-scrollbar{
  width: 0px;
  height:5px;
  background-color: #161925;
}

::-webkit-scrollbar-thumb{
  background-color: #F1D302;
  border-radius:10px;
  box-shadow: insert 0 0 6px rgba(0,0,0,.3);
}

.spacing{
  padding: 6px;
}
/*This css file defines the color scheme and font of all of the webpages so import into every new webpage*/

body {
  font-family: 'Rubik', sans-serif;
  background-color: #9E2B25;
  color:#FDFFFC;
}
h4{
  color:#FDFFFC;
}
.button{
    background-color:#0267C1;
}
.nav-pills .nav-link.active
{
  background-color: #0267c1;

}
h3{
    color: #ffffff;
}
#cardimg
{
  height:300px;
}

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <title>STEMuli</title>
  <!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
  <link href="https://fonts.googleapis.com/css?family=Rubik:500" rel="stylesheet">
  <link href="/css/mastercss.css" rel="stylesheet">
  <link rel="stylesheet" href="/css/profile.css" crossorigin="anonymous">
  <script src="/js/moment.js"></script>


</head>
<script>
  (function() {
    ('[data-toggle="popover"]').popover()
  })
</script>

<body>

  <!--This is where the logo is-->

    <div id="row" class="row h-100 justify-content-center">
      <img src="/img/tcb-logo.png" class="img-fluid" alt="Responsive image">
      </a>
    </div>
    <ul class="nav nav-pills mb-3 justify-content-center" id="pills-tab" role="tablist">
      <li class="nav-item">
        <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-STEM" role="tab" aria-controls="pills-home" aria-selected="true"><h3>STEMuli</h3></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-Community" role="tab" aria-controls="pills-profile" aria-selected="false"><h3>Community</h3></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-aboutUs" role="tab" aria-controls="pills-contact" aria-selected="false"><h3>Who We Are</h3></a>
      </li>
    </ul>
    <div class="tab-content" id="pills-tabContent">
      <div class="tab-pane fade" id="pills-STEM" role="tabpanel" aria-labelledby="pills-home-tab">
<div class="row">
  <h2>Credit</h2>
    <div class="row__inner">
      <a onclick="redirectbankon()">
        <div class="tile" data-toggle="popover" data-trigger="hover" data-placement="right" data-html="true" title="Description" data-content="The Bank On It module provides an overview of banking services and is designed to help participants build a positive relationship with a financial institution.">
          <div class="tile__media">
            <img class="tile__img" src="/img/bankonit.png" alt="" />
          </div>
          <div class="tile__details">
            <div class="tile__title">
              <h5>Bank On It</h5>
            </div>
          </div>
        </div>
        <div class="tile">
          <div class="tile__media">
            <img class="tile__img" src="/img/borrowing.png" alt="" />
          </div>
          <div class="tile__details">
            <div class="tile__title">
              <h5>Borrowing Basics</h5>
            </div>
          </div>
        </div>
        <div class="tile">
          <div class="tile__media">
            <img class="tile__img" src="/img/keepitsafe.png" alt="" />
          </div>
          <div class="tile__details">
            <div class="tile__title">
              <h5>Keep it Safe</h5>
            </div>
          </div>
        </div>
        <div class="tile">
          <div class="tile__media">
            <img class="tile__img" src="/img/checkitoutpt1.png" alt="" />
          </div>
          <div class="tile__details">
            <div class="tile__title">
              <h5>Check It Out</h5>
            </div>
          </div>
        </div>
        <div class="tile">
          <div class="tile__media">
            <img class="tile__img" src="/img/yourownhome.png" alt="" />
          </div>
          <div class="tile__details">
            <div class="tile__title">
              <h5>Your Own Home</h5>
            </div>
          </div>
        </div>

    </div>
  </div>
</div>
      </div>
      <div class="tab-pane fade" id="pills-Community" role="tabpanel" aria-labelledby="pills-profile-tab">How are you</div>
      <div class="tab-pane fade" id="pills-aboutUs" role="tabpanel" aria-labelledby="pills-contact-tab">.</div>
    </div>


  </main>

  <!-- Bootstrap core JavaScript
    ================================================== -->
  <!-- Placed at the end of the document so the pages load faster -->
  <script type="text/JavaScript" src="/js/redirect.js"></script>
  <script type="text/JavaScript" src="/js/form.js"></script>
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>


  <script>
    $(function() {
      $('[data-toggle="popover"]').popover()
    })
  </script>
</body>

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

1 个答案:

答案 0 :(得分:1)

你有很多无效的HTML标记,一些未封闭的标记和一个未知的</main>标记,最终在正文之前,一个未封闭的<a href='#.' onclick="redirectbankon()">正在包装嵌套的div.tile,这是好的,如果您使用的是HTML5,但仍需关闭它。更好的方法是向锚点提供id,然后将click事件绑定到锚点,以便在点击时调用该函数。

删除HTML中的缺陷,它可以通过替换内容而不是在第一个内容下添加标签来正常工作。

请参阅下面的代码演示。

.popover-header {
  color: #000000;
}

#row {
  overflow: hidden;
}

.logo {
  z-index: 0;
}

.row {
  overflow: scroll;
  width: 100%;
  z-index: 1;
}

.row__inner {
  -webkit-transition: 450ms -webkit-transform;
  transition: 450ms -webkit-transform;
  transition: 450ms transform;
  transition: 450ms transform, 450ms -webkit-transform;
  font-size: 0;
  white-space: nowrap;
  margin: 50px 0;
  padding-bottom: 30px;
  padding-bottom: 30px;
}

.tile {
  position: relative;
  display: inline-block;
  width: 250px;
  height: 250px;
  margin-right: 10px;
  margin-left: 50px;
  font-size: 20px;
  cursor: pointer;
  -webkit-transition: 450ms all;
  transition: 450ms all;
  -webkit-transform-origin: center left;
  transform-origin: center left;
}

.tile__img {
  width: 250px;
  height: 250px;
  -o-object-fit: cover;
  object-fit: cover;
}

.tile__details {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 0;
  font-size: 10px;
  opacity: 0;
  background: -webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.9)), to(rgba(0, 0, 0, 0)));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
  -webkit-transition: 450ms opacity;
  transition: 450ms opacity;
}

.tile__details:after,
.tile__details:before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  display: #000;
}

.tile__details:before {
  left: 0;
  width: 100%;
  font-size: 30px;
  margin-left: 7px;
  margin-top: -18px;
  text-align: center;
  z-index: 2;
}

.tile:hover .tile__details {
  opacity: 1;
}

.tile__title {
  position: absolute;
  bottom: 0;
  padding: 10px;
}

.row__inner:hover {
  -webkit-transform: translate3d(-62.5px, 0, 0);
  transform: translate3d(-62.5px, 0, 0);
}

.row__inner:hover .tile {
  opacity: 0.3;
}

.row__inner:hover .tile:hover {
  -webkit-transform: scale(1.5);
  transform: scale(1.5);
  opacity: 1;
}

.tile:hover~.tile {
  -webkit-transform: translate3d(125px, 0, 0);
  transform: translate3d(125px, 0, 0);
}

a:hover {
  color: #F1D302;
}

.checkbox-wrapper {
  height: 13px;
  width: 13px;
}

.btn {
  background-color: #F1D302;
}

body {
  font-family: 'Rubik', sans-serif;
}

.card-img-top {
  height: 300px;
  width: 100%;
}

.btn-xlong {
  padding: 10px 50px;
  font-size: 22px;
  line-height: normal;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  border-radius: 10px;
}

.steps-form-3 {
  width: 2px;
  height: 470px;
  position: relative;
}

.steps-form-3 .steps-row-3 {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.steps-form-3 .steps-row-3:before {
  top: 14px;
  bottom: 0;
  position: absolute;
  content: "";
  width: 2px;
  height: 100%;
  background-color: #7283a7;
}

.steps-form-3 .steps-row-3 .steps-step-3 {
  height: 150px;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  text-align: center;
  position: relative;
}

.steps-form-3 .steps-row-3 .steps-step-3.no-height {
  height: 50px;
}

.steps-form-3 .steps-row-3 .steps-step-3 p {
  margin-top: 0.5rem;
}

.steps-form-3 .steps-row-3 .steps-step-3 button[disabled] {
  opacity: 1 !important;
  filter: alpha(opacity=100) !important;
}

.steps-form-3 .steps-row-3 .steps-step-3 .btn-circle-3 {
  width: 60px;
  height: 60px;
  border: 2px solid #59698D;
  background-color: white !important;
  color: #59698D !important;
  border-radius: 50%;
  padding: 18px 18px 15px 15px;
  margin-top: -22px;
}

.steps-form-3 .steps-row-3 .steps-step-3 .btn-circle-3:hover {
  border: 2px solid #4285F4;
  color: #4285F4 !important;
  background-color: white !important;
}

.steps-form-3 .steps-row-3 .steps-step-3 .btn-circle-3 .fa {
  font-size: 1.7rem;
}

::-webkit-scrollbar {
  width: 0px;
  height: 5px;
  background-color: #161925;
}

::-webkit-scrollbar-thumb {
  background-color: #F1D302;
  border-radius: 10px;
  box-shadow: insert 0 0 6px rgba(0, 0, 0, .3);
}

.spacing {
  padding: 6px;
}


/*This css file defines the color scheme and font of all of the webpages so import into every new webpage*/

body {
  font-family: 'Rubik', sans-serif;
  background-color: #9E2B25;
  color: #FDFFFC;
}

h4 {
  color: #FDFFFC;
}

.button {
  background-color: #0267C1;
}

.nav-pills .nav-link.active {
  background-color: #0267c1;
}

h3 {
  color: #ffffff;
}

#cardimg {
  height: 300px;
}
<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <title>STEMuli</title>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
        crossorigin="anonymous">
    <link href="https://fonts.googleapis.com/css?family=Rubik:500" rel="stylesheet">
    <link href="/css/mastercss.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/profile.css" crossorigin="anonymous">
    <script src="/js/moment.js"></script>


</head>
<script>
    (function () {
        ('[data-toggle="popover"]').popover()
    })
</script>

<body>

    <!--This is where the logo is-->

    <div id="row" class="row h-100 justify-content-center">
        <img src="/img/tcb-logo.png" class="img-fluid" alt="Responsive image">
    </div>
    <ul class="nav nav-pills mb-3 justify-content-center" id="pills-tab" role="tablist">
        <li class="nav-item">
            <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-STEM" role="tab" aria-controls="pills-home"
                aria-selected="true">
                <h3>STEMuli</h3>
            </a>
        </li>
        <li class="nav-item">
            <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-Community" role="tab" aria-controls="pills-profile"
                aria-selected="false">
                <h3>Community</h3>
            </a>
        </li>
        <li class="nav-item">
            <a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-aboutUs" role="tab" aria-controls="pills-contact"
                aria-selected="false">
                <h3>Who We Are</h3>
            </a>
        </li>
    </ul>
    <div class="tab-content" id="pills-tabContent">
        <div class="tab-pane fade" id="pills-STEM" role="tabpanel" aria-labelledby="pills-home-tab">
            <div class="row">
                <h2>Credit</h2>
                <div class="row__inner">
                    <a href='#.' onclick="redirectbankon()">
                        <div class="tile" data-toggle="popover" data-trigger="hover" data-placement="right" data-html="true" title="Description"
                            data-content="The Bank On It module provides an overview of banking services and is designed to help participants build a positive relationship with a financial institution.">
                            <div class="tile__media">
                                <img class="tile__img" src="/img/bankonit.png" alt="" />
                            </div>
                            <div class="tile__details">
                                <div class="tile__title">
                                    <h5>Bank On It</h5>
                                </div>
                            </div>
                        </div>
                        <div class="tile">
                            <div class="tile__media">
                                <img class="tile__img" src="/img/borrowing.png" alt="" />
                            </div>
                            <div class="tile__details">
                                <div class="tile__title">
                                    <h5>Borrowing Basics</h5>
                                </div>
                            </div>
                        </div>
                        <div class="tile">
                            <div class="tile__media">
                                <img class="tile__img" src="/img/keepitsafe.png" alt="" />
                            </div>
                            <div class="tile__details">
                                <div class="tile__title">
                                    <h5>Keep it Safe</h5>
                                </div>
                            </div>
                        </div>
                        <div class="tile">
                            <div class="tile__media">
                                <img class="tile__img" src="/img/checkitoutpt1.png" alt="" />
                            </div>
                            <div class="tile__details">
                                <div class="tile__title">
                                    <h5>Check It Out</h5>
                                </div>
                            </div>
                        </div>
                        <div class="tile">
                            <div class="tile__media">
                                <img class="tile__img" src="/img/yourownhome.png" alt="" />
                            </div>
                            <div class="tile__details">
                                <div class="tile__title">
                                    <h5>Your Own Home</h5>
                                </div>
                            </div>
                        </div>

                    </a>
                </div>
            </div>
        </div>
        <div class="tab-pane fade" id="pills-Community" role="tabpanel" aria-labelledby="pills-profile-tab">How are you</div>
        <div class="tab-pane fade" id="pills-aboutUs" role="tabpanel" aria-labelledby="pills-contact-tab">.</div>
    </div>




    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script type="text/JavaScript" src="/js/redirect.js"></script>
    <script type="text/JavaScript" src="/js/form.js"></script>
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
        crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
        crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
        crossorigin="anonymous"></script>


    <script>
        $(function () {
            $('[data-toggle="popover"]').popover()
        })
    </script>
</body>

</html>