HTML中的选项卡内的水平线

时间:2016-08-17 03:00:13

标签: html css

我按照这些页面创建一条水平线: horizontal line and right way to code it in html, css

http://www.w3schools.com/tags/tag_hr.asp

http://www.jacklmoore.com/notes/jquery-tabs/

但似乎它在我的标签元素内部不起作用。这是我的代码:

 <div class="container-fluid">
         <div class="tabbable js-report-tab-container">
            <div class="tab-content">
            <div class="tab-pane active" id="tab1">
                <div id="circle"></div> <div class="h_line"> **<!-- horizontal line should be here -->**</div> <span id="circle"></span>
                 <br/><br/>
                 <p>Choose one of these type of reports : </p>
                   <input type="checkbox" name="report" value="reportValue" checked > Summary <br/>
                   <input type="checkbox" name="report" value="reportValue" > Candidate Details <br/>
                    <input type="checkbox" name="report" value="reportValue" > . . . .
               </div>
                 <div class="tab-pane" id="tab2">
                      This is the second step view...
                  </div>
                  <div class="tab-pane" id="tab3">
                      This is the third step view...
                    </div>
                   <div class="tab-pane" id="tab4">
                     This is the fourth step view...
                     </div>
                    </div> {{-- end of tab-content --}}
                    </div> {{-- end of tabbable --}}
        </div>
<style type="text/css">   
#circle {
    width: 40px;
    height: 40px;
    background: blue;
    -moz-border-radius: 20px;
    -webkit-border-radius: 20px;
    border-radius: 20px;
     float: left;
}

.hline {
    width:100%;
    height:13px;
    background: #ff0000;
    clear:both;
    display:inline;
}

hr{
    display:inline;
    margin-top: 0.5em;
    border-width: 0.5px;
    border-style: inset;
    margin-bottom: 0.5em;

    height:2px;
    background: #00FF00;
    width: 20%;
    align:left;

</style>

我尝试使用<hr align="left" />和css样式:

hr{
    display:block;
    margin-top: 2.5em;
    border-width: 1px;
    border-style: inset;
    margin-bottom: 0.5em;
    border-top:1px solid;
    height:2px;
    background: #00FF00;
    width: 20%;
    align:left;
}

结果是这样的: enter image description here

我还尝试使用<div class="block_1">Lorem</div> <div class="h_line"></div> css:.hline { width:30%; height:13px; background: #fff } 结果是什么: enter image description here

我在这里错过了什么......?我的目标是在这两个圆圈之间创建一个水平线。

提前致谢...需要哎呀...... :)

2 个答案:

答案 0 :(得分:1)

我并不完全清楚你在寻找什么,但这里有一种在编号圆圈之间渲染水平线的方法。我过去曾使用类似的东西作为进度指示器。

&#13;
&#13;
.circles {
  border-bottom: 10px solid #000;
  display: block;
  height: 0;
  list-style-type: none;
  margin: 15px auto;
  position: relative;
  width: 80%;
}

.circle {
  background: #00f;
  border-radius: 50%;
  color: #fff;
  height: 40px;
  line-height: 40px;
  margin: -20px 0 0 -20px;
  position: absolute;
  text-align: center;
  top: 5px;
  width: 40px;
}

.circle:nth-child(1) {
  left: 0;
}

.circle:nth-child(2) {
  left: 50%;
}

.circle:nth-child(3) {
  left: 100%;
}
&#13;
<p>Lorem ipsum dolor sit amet.</p>
<ul class="circles">
  <li class="circle">1</li>
  <li class="circle">2</li>
  <li class="circle">3</li>
</ul>
<p>Lorem ipsum dolor sit amet.</p>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

我建议使用Bootstrap的列来做这样的事情:

<div class="row">
     <div class="col-md-2"><div class="circle"></div></div>
     <div class="col-md-8"><hr /></div>
     <div class="col-md-2"><div class="circle"></div></div>
</div>