如何将侧导航栏上的用户图标转到中心?以及如何为侧导航栏创建边框?

时间:2017-03-26 06:13:06

标签: html css html5 css3 sass

我正在尝试将用户个人资料图标置于中心位置,以便我最难做到这一点。我也尝试在导航栏周围添加边框,以便它不会显示在我的页面上,我无法弄明白。我正在尝试重新创造优步的所有内容 - 请参阅附图。uber rider side nav bar有人请指出我正确的方向吗?谢谢!

//来自我的HTML页面

      <div class="container-fluid">
        <div class="row">
          <div class="col-sm-2">
[![enter image description here][1]][1]
            <!-- side bar -->
              <div class="row">
                <div class="profile-sidenav-cell">
                    <span class="glyphicon glyphicon-user custom-icon"></span>   
                </div>
              </div>

              <div class="row">
                <div class="profile-sidenav-cell">
                <ul class="side-menu-tabs">
                  <li><a href="/profile">Profile</a></li>
                  <li><a href="#">Trips</a></li>
                  <li><a href="/logout">Log Out</a></li>
                </ul>

                </div>
              </div>
            <!-- side bar end -->
          </div>


          <div class="col-sm-10" style="background-color: green;">Page Content</div>
        </div>
      </div>

//来自我的CSS页面

.profile-sidenav-cell{
  position: relative;
  background-color: #eee;
  margin: 0px 0px 0px 20px;
}

.profile-sidenav-div {
  background-color: purple; 
  position: absolute;
  top: 100%;
  left: 50%;
  height: 100px;
  width: 100px;
}

.custom-icon {
  font-size: 70px;
  background: white;
  padding: 30px;
  border-radius:100%;
  border:0.5px solid #ccc; 
  color:#ccc; 
  box-shadow: inset 0px 0px 20px 10px rgba(0,0,0,0.25);
  display:table-cell;
  width:100%;
  height:100%;
}

.profile-sidenav-cell ul {
    margin: 0px; 
    padding: 0;
    list-style-type: none;
}

.profile-sidenav-cell ul li a {
    text-decoration: none;
    color: gray; 
    padding: 11px 11px 10px;
    background-color: white;
    display:block;
}

.profile-sidenav-cell ul li a:visited {
    color: gray;
}

.profile-sidenav-cell ul li a:hover, .side-menu-tabs ul li .current {
    color: white;
    background-color: gray;
}

1 个答案:

答案 0 :(得分:0)

替换此css类

.custom-icon {
  font-size: 70px;
  background: white;
  padding: 30px;
  border-radius:100%;
  border:0.5px solid #ccc; 
  color:#ccc; 
  box-shadow: inset 0px 0px 20px 10px rgba(0,0,0,0.25);

}
.profile-sidenav-cell ul li a {
    text-decoration: none;
    color: gray; 
    padding: 11px 11px 10px;
    background-color: white;
    display:block;
    text-align:left;
}

和html

<div class="container-fluid">
        <div class="row">
          <div class="col-sm-2 text-center">
[![enter image description here][1]][1]
            <!-- side bar -->
              <div class="row">
                <div class="profile-sidenav-cell">
                    <span class="glyphicon glyphicon-user custom-icon"></span>   
                </div>
              </div>

              <div class="row">
                <div class="profile-sidenav-cell">
                <ul class="side-menu-tabs">
                  <li><a href="/profile">Profile</a></li>
                  <li><a href="#">Trips</a></li>
                  <li><a href="/logout">Log Out</a></li>
                </ul>

                </div>
              </div>
            <!-- side bar end -->
          </div>


          <div class="col-sm-10" style="background-color: green;">Page Content</div>
        </div>
      </div>

Fiddler https://jsfiddle.net/64ccmL0o/3/