第二个元素的css,在<li>个不同的CSS样式属性中给第二个元素

您需要使用.progressbar li:nth-child(2n)定位其他所有li元素,然后需要将整个伪元素向上移动,然后将线和圆(:before和:after)向下移动。这将是一个很多,如果你没有足够的文字,线条和圆圈所有连接到相同的元素/ pseudoelement容易。

查看代码段:

var progressBar = {

Bar: $('#progress-bar'),

Reset: function() {

if (this.Bar) {

//   this.Bar.find('li').addClass('active');

}

},

Next: function() {

$('#progress-bar li:not(.active):first').addClass('active');

},

Back: function() {

$('#progress-bar li.active:last').removeClass('active');

}

}

progressBar.Reset();

$("#Next").on('click', function() {

progressBar.Next();

})

$("#Back").on('click', function() {

progressBar.Back();

})

$("#Reset").on('click', function() {

progressBar.Reset();

})

.progressbar {

margin: 50px 0 50px 0;

counter-reset: step;

}

.progressbar li {

width: 12.5%;

list-style-type: none;

float: left;

font-size: 12px;

position: relative;

text-align: center;

text-transform: uppercase;

color: #555555;

}

.progressbar li:before {

position: relative;

width: 15px;

height: 15px;

content: '';

line-height: 30px;

border: 2px solid #555555;

background-color: #555555;

display: block;

text-align: center;

margin: 0 auto 10px auto;

border-radius: 50%;

transition: all .8s;

}

.progressbar li:after {

width: 100%;

height: 2px;

content: '';

position: absolute;

background-color: #555555;

top: 7px;

left: -50%;

z-index: -1;

transition: all .8s;

}

.progressbar li:first-child:after {

content: none;

}

.progressbar li.active:before {

border-color: #55b776;

background-color: #55b776;

transition: all .8s;

}

.progressbar li.active:after {

background-color: #55b776;

transition: all .8s;

}

.btn {

background-color: #55b776;

margin: 5px;

width: 75px;

color: white;

}

.btn:hover {

color: white;

}

.btn:focus {

color: white;

}

.btn-container {

display: flex;

justify-content: center;

width: 100%;

position: absolute;

bottom: 0;

}

body {

background-color: #f7f7f7;

}

.progressbar li:nth-child(2n) {

top: -50px;

}

.progressbar li:nth-child(2n):before {

top: 50px;

}

.progressbar li:nth-child(2n):after {

top: 57px;

}

Simple Step Progress Bar
  • Art
  • daten
  • zeit
  • ort
  • Pdf
  • Bilder
  • INFO
  • Bezahlen

Next

Back

Reset

以下CSS规则可以解决问题:

.progressbar li:nth-child(2n) {

top: -50px;

}

.progressbar li:nth-child(2n):after {

top: 57px;

}

.progressbar li:nth-child(2n):before {

top: 50px;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一、页面有一个div,通过嵌入式样式设置这个div的高度200px,宽度200px边框是3px的蓝色实线,并且是圆形。 ```html <div style="width: 200px; height: 200px; border: 3px solid blue; border-radius: 50%;"></div> ``` 二、给页面上的未访问的a链接的字体颜色设置为黄色;给页面的已经点击过的a链接字体颜色设置为红色; ```html <style> a:link { color: yellow; } a:visited { color: red; } </style> ``` 三、写出下面样式的权重值,并写出能够使之生效的html代码 样式的权重值分别为:0111(form input[name="txt"])和 0021(div>.item:hover)。 ```html <form> <input type="text" name="txt" value="Hello World!"> </form> <div> <p class="item">This is a paragraph.</p> <p class="item">This is another paragraph.</p> </div> ``` 四、创建一个导航栏,包含影院、电影和个人心三个选项,这个导航栏距离页面顶部200px,当导航栏滚动到页面顶部时,会自动吸附在顶部不会消失。 ```html <style> .navbar { position: fixed; top: 200px; width: 100%; background-color: #f1f1f1; } </style> <div class="navbar"> <a href="#">影院</a> <a href="#">电影</a> <a href="#">个人心</a> </div> ``` 五、创建一个表单,可输入账号(文本框)和密码(密码框),点击提交按钮,可以提交到reg.html页面(显示注册成功),点击重置按钮可以恢复表单的初始状态。 ```html <form action="reg.html"> <label for="username">账号:</label> <input type="text" id="username" name="username"><br><br> <label for="password">密码:</label> <input type="password" id="password" name="password"><br><br> <input type="submit" value="提交"> <input type="reset" value="重置"> </form> ``` 六、页面有无序列表,将页面所有元素的第一个li子元素的字体颜色设置位红色。 ```html <style> li:first-child { color: red; } </style> <ul> <li>HTML</li> <li>CSS</li> <li>JS</li> </ul> <ol> <li>语文</li> <li>数学</li> <li>英语</li> </ol> ``` 七、在页面放置一个p标签,设置它距离左边为200px,上边为100px。 ```html <p style="position: absolute; top: 100px; left: 200px;">这是一个段落</p> ``` 八、设置div的所有元素水平分布,并且垂直居。 ```html <style> #box { display: flex; justify-content: space-between; align-items: center; height: 200px; } </style> <div id="box" style="border: 1px solid red;"> <p>张三</p> <p>李四</p> <p>王五</p> </div> ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值