如何在Bootstrap中创建单独的两行?

时间:2017-09-20 17:35:05

标签: html css twitter-bootstrap

在Bootstrap中创建两行时遇到问题。

第一行似乎工作不正确。

它只显示1/2内容。

喜欢这张图片:

我不知道为什么。

您可以看到我的示例代码:

body {
  margin: 100px auto;
  font-family: Helvetica;
  background: #FFF;
}

#crumbs ul {
  list-style: none;
  display: inline-table;
}
#crumbs ul li {
  display: inline;
}
#crumbs ul li a {
  display: block;
  float: left;
  height: 50px;
  background: #F3F5FA;
  text-align: center;
  padding: 30px 20px 0 60px;
  position: relative;
  margin: 0 10px 0 0;
  font-size: 20px;
  text-decoration: none;
  color: #8093A7;
}
#crumbs ul li a:after {
  content: "";
  border-top: 40px solid transparent;
  border-bottom: 40px solid transparent;
  border-left: 40px solid #F3F5FA;
  position: absolute;
  right: -40px;
  top: 0;
  z-index: 1;
}
#crumbs ul li a:before {
  content: "";
  border-top: 40px solid transparent;
  border-bottom: 40px solid transparent;
  border-left: 40px solid #fff;
  position: absolute;
  left: 0;
  top: 0;
}

#crumbs ul li:first-child a {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

#crumbs ul li:first-child a:before {
  display: none;
}

#crumbs ul li:last-child a {
  padding-right: 40px;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

#crumbs ul li:last-child a:after {
  display: none;
}

#crumbs ul li a:hover {
  background: #357DFD;
  color: #fff;
}

#crumbs ul li a:hover:after {
  border-left-color: #357DFD;
  color: #fff;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid color-body">
    <div class="row">
        <div class="container">
            <div id="crumbs">
                <ul>
                    <li><a href="#1"><i class="fa fa-home" aria-hidden="true"></i></a></li>
                    <li><a href="#2"><i class="fa fa-shopping-bag" aria-hidden="true"></i> Shop</a></li>
                    <li><a href="#3"><i class="fa fa-cart-plus" aria-hidden="true"></i> Cart</a></li>
                    <li><a href="#4"><i class="fa fa-credit-card-alt" aria-hidden="true"></i> Checkout</a></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="container">
            <ul id="filters" class="loaiduan clearfix">
                <li class="li-selected">
                    <h3>Mobile</h3>
                </li>
            </ul>

            <div id="container" class="list">
                <article class="list--item">
                    <figure class="text-center">
                        <h5>Nokia N95</h5>
                        <a href="#" class="btn btn-primary responsive-width">View more</a>
                    </figure>
                </article>
              <article class="list--item">
                    <figure class="text-center">
                        <h5>Nokia E63</h5>
                        <a href="#" class="btn btn-primary responsive-width">View more</a>
                    </figure>
                </article>
            </div>
        </div>
</div>

或指向我笔的链接:

https://codepen.io/vanloc/pen/VMjwYQ

2 个答案:

答案 0 :(得分:2)

#crumbs ul li a:after#crumbs ul li a:before的总高度设置为80px(箭头顶部为40,底部为40),但#crumbs ul li a本身的高度为50px 。尝试将其设置为80px。

答案 1 :(得分:1)

我发现你的问题,这个问题创建你的自定义Css,只需设置高度..

#crumbs ul li a{ height: 82px; }