【问题标题】:Horizontal Line Inside a Tab in HTMLHTML中选项卡内的水平线
【发布时间】:2018-07-10 12:17:36
【问题描述】:

我正在关注这些页面来创建一条水平线: 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>

我尝试使用 &lt;hr align="left" /&gt; 和 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;
}

结果是这样的:

我也尝试使用&lt;div class="block_1"&gt;Lorem&lt;/div&gt; &lt;div class="h_line"&gt;&lt;/div&gt; CSS : .hline { width:30%; height:13px; background: #fff } 结果什么都没有:

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

提前谢谢...这里需要帮助.. :)

【问题讨论】:

  • 更改后显示所有代码?
  • 我只是更改了
    并应用了 css 样式,但没有任何更改......嗯......我没有t更改另一个代码先生。 @kollein
  • 设置 .h_line css: width:100%;clear:both;
  • width:100% 和 clearh:both 没有任何变化;先生。科林... :')
  • 显示:块导致 hr 在自己的行上。尝试显示:内联。

标签: html css


【解决方案1】:

我并不完全清楚您要查找的内容,但这是在编号圆圈之间呈现水平线的一种方法。过去我曾将类似的东西用于进度指示器。

.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%;
}
<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>

【讨论】:

  • ooowh..顺便说一句....什么是第n个孩子布兰登先生...??我刚遇到那种风格...似乎将圆圈1、2、3、4之间的空间分开,但是...嗯... nth-child 有什么特别之处吗?例如,我可以在 div、按钮或复选框等其他元素中使用它吗?? :)
  • @HyosokaPoipo:是的,您可以在任何元素上使用:nth-child(n)google.com/#q=nth-child
【解决方案2】:

我建议使用 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>

【讨论】:

  • 圆圈相隔很远,但它们之间没有水平线... :')
猜你喜欢
  • 2015-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-04
  • 1970-01-01
  • 1970-01-01
  • 2017-10-17
相关资源
最近更新 更多