gpt4 book ai didi

html - Bootstrap 垂直时间轴到水平时间轴

转载 作者:行者123 更新时间:2023-11-28 02:10:04 28 4
gpt4 key购买 nike

我创建了一个垂直时间线,需要将其完全更改为水平时间线。我正试图让它水平,但它没有按预期工作。

发布了完整的 CSS 和 HTML 代码以及当前进度的 codepen 链接。

此外,时间线需要在水平 View 中响应。

链接

https://codepen.io/anon/pen/yvPLrP

#Timline {
background-color: #FFFFFF;
}

.Timline-wrapper {
position: relative;
clear: both;
overflow: hidden;
}

.Timline-wrapper:nth-of-type(odd) .Timline-item {
padding-left: 100px;
padding-right: 0;
padding-bottom: 50px;
float: right;
}

.Timline-wrapper:nth-of-type(odd) .Timline-box:after {
left: -20px;
right: auto;
border-color: transparent;
text-align: left;
border-right: 10px solid #fff;
border-left-color: transparent !important;
}

.Timline-wrapper:nth-of-type(odd) .Timline-icon {
right: auto;
left: -32px;
}

.Timline-wrapper:nth-of-type(odd) .Timline-year {
text-align: right;
right: 140%;
left: auto;
}

.Timline-holder:before {
content: '';
position: absolute;
top: 0;
left: 50%;
margin-left: -4px;
height: 100%;
width: 4px;
background: #939393;
opacity: 0.5;
}

.Timline-item {
padding-right: 100px;
padding-bottom: 50px;
padding-top: 50px;
}

.Timline-year {
top: 40px;
position: absolute;
width: 100%;
left: 140%;
}

.Timline-year>* {
margin: 0;
}

.Timline-icon {
border-radius: 50%;
background: #fff;
position: absolute;
width: 60px;
height: 60px;
right: -28px;
top: 72px;
z-index: 9;
cursor: pointer;
border: 2px solid transparent;
transition: all 0.3s ease-in-out;
}

.Timline-icon:before {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.Timline-icon:hover {
color: #E3000F;
border: 2px solid #E3000F;
transform: translateY(-6px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.Timline-box {
background-color: #fff;
padding: 15px;
position: relative;
}

.Timline-box h3,
.Timline-box h5 {
text-transform: capitalize;
}

.Timline-box:after {
content: "";
display: block;
position: absolute;
right: -20px;
top: 40px;
border: 10px solid transparent;
border-left: 10px solid #fff;
}

.Timline-box:hover {
cursor: pointer;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.Timline-box:hover+.Timline-icon {
color: #E3000F;
border: 2px solid #E3000F;
transform: translateY(-6px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.Timline-box {
background-color: #fff;
padding: 15px;
}


/* Timline Responsive */

@media (min-width: 992px) and (max-width: 1024px) {
.Timline-year {
left: 152%;
}
.Timline-wrapper:nth-of-type(odd) .Timline-year {
right: 152%;
}
}

@media (max-width: 768px) {
.Timline-item {
padding-right: 15px;
margin-left: 65px;
padding-top: 20px;
}
.Timline-holder:before {
left: 37px;
}
.Timline-icon {
left: -60px;
right: auto;
top: 42px;
}
.Timline-year {
position: relative;
top: 0;
left: 0;
}
.Timline-box:after {
left: -20px;
right: auto;
border-color: transparent;
text-align: left;
border-right: 10px solid #fff;
border-left-color: transparent !important;
}
.Timline-wrapper:nth-of-type(odd) .Timline-item {
padding-right: 15px;
padding-left: 15px;
margin-left: 65px;
float: none;
}
.Timline-wrapper:nth-of-type(odd) .Timline-icon {
left: -60px;
right: auto;
}
.Timline-wrapper:nth-of-type(odd) .Timline-year {
position: relative;
top: 0;
left: 0;
text-align: left;
}
}
<!-- Timline Section -->
<section id="Timline">
<div class="container">
<div class="section-content">
<div class="row">
<!-- Section Title -->
<div class="col-md-12 section-title text-center">
<span class="divider center"></span>
<h2>Timline</h2>
</div>
<!-- End of Section Title -->
<!-- Timline-1 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class="Timline-box" data-aos="fade-right">
<h3>One</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-paint-brush"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-1 -->
<!-- Timline-2 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Two</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-star"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-2 -->
<!-- Timline-3 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Three</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-3 -->
<!-- Timline-4 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Four</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-star"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-4 -->
<!-- Timline-5 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Five</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-paint-brush"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-5 -->
<!-- Timline-6 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Six</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-star"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-6 -->
<!-- Timline-7 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Seven</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-7 -->
<!-- Timline-8 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Eight</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-star"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-8 -->
<!-- Timline-9 -->
<div class="Timline-wrapper">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Nine</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</div>
<!-- End of Timline-9 -->

</div>
</div>
</div>
</section>
<!-- End of Timline Section -->

最佳答案

你可以根据自己的需要修改

/* Timeline */

.timeline,
.timeline-horizontal {
list-style: none;
padding: 20px;
position: relative;
}

.timeline:before {
top: 40px;
bottom: 0;
position: absolute;
content: " ";
width: 3px;
background-color: #eeeeee;
left: 50%;
margin-left: -1.5px;
}

.timeline .timeline-item {
margin-bottom: 20px;
position: relative;
}

.timeline .timeline-item:before,
.timeline .timeline-item:after {
content: "";
display: table;
}

.timeline .timeline-item:after {
clear: both;
}

.timeline .timeline-item .timeline-badge {
color: #fff;
width: 54px;
height: 54px;
line-height: 52px;
font-size: 22px;
text-align: center;
position: absolute;
top: 18px;
left: 50%;
margin-left: -25px;
background-color: #7c7c7c;
border: 3px solid #ffffff;
z-index: 100;
border-top-right-radius: 50%;
border-top-left-radius: 50%;
border-bottom-right-radius: 50%;
border-bottom-left-radius: 50%;
}

.timeline .timeline-item .timeline-badge i,
.timeline .timeline-item .timeline-badge .fa,
.timeline .timeline-item .timeline-badge .glyphicon {
top: 2px;
left: 0px;
}

.timeline .timeline-item .timeline-badge.primary {
background-color: #1f9eba;
}

.timeline .timeline-item .timeline-badge.info {
background-color: #5bc0de;
}

.timeline .timeline-item .timeline-badge.success {
background-color: #59ba1f;
}

.timeline .timeline-item .timeline-badge.warning {
background-color: #d1bd10;
}

.timeline .timeline-item .timeline-badge.danger {
background-color: #ba1f1f;
}

.timeline .timeline-item .timeline-panel {
position: relative;
width: 46%;
float: left;
right: 16px;
border: 1px solid #c0c0c0;
background: #ffffff;
border-radius: 2px;
padding: 20px;
-webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
}

.timeline .timeline-item .timeline-panel:before {
position: absolute;
top: 26px;
right: -16px;
display: inline-block;
border-top: 16px solid transparent;
border-left: 16px solid #c0c0c0;
border-right: 0 solid #c0c0c0;
border-bottom: 16px solid transparent;
content: " ";
}

.timeline .timeline-item .timeline-panel .timeline-title {
margin-top: 0;
color: inherit;
}

.timeline .timeline-item .timeline-panel .timeline-body>p,
.timeline .timeline-item .timeline-panel .timeline-body>ul {
margin-bottom: 0;
}

.timeline .timeline-item .timeline-panel .timeline-body>p+p {
margin-top: 5px;
}

.timeline .timeline-item:last-child:nth-child(even) {
float: right;
}

.timeline .timeline-item:nth-child(even) .timeline-panel {
float: right;
left: 16px;
}

.timeline .timeline-item:nth-child(even) .timeline-panel:before {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}

.timeline-horizontal {
list-style: none;
position: relative;
padding: 20px 0px 20px 0px;
display: inline-block;
}

.timeline-horizontal:before {
height: 3px;
top: auto;
bottom: 26px;
left: 56px;
right: 0;
width: 100%;
margin-bottom: 20px;
}

.timeline-horizontal .timeline-item {
display: table-cell;
height: 280px;
width: 20%;
min-width: 320px;
float: none !important;
padding-left: 0px;
padding-right: 20px;
margin: 0 auto;
vertical-align: bottom;
}

.timeline-horizontal .timeline-item .timeline-panel {
top: auto;
bottom: 64px;
display: inline-block;
float: none !important;
left: 0 !important;
right: 0 !important;
width: 100%;
margin-bottom: 20px;
}

.timeline-horizontal .timeline-item .timeline-panel:before {
top: auto;
bottom: -16px;
left: 28px !important;
right: auto;
border-right: 16px solid transparent !important;
border-top: 16px solid #c0c0c0 !important;
border-bottom: 0 solid #c0c0c0 !important;
border-left: 16px solid transparent !important;
}

.timeline-horizontal .timeline-item:before,
.timeline-horizontal .timeline-item:after {
display: none;
}

.timeline-horizontal .timeline-item .timeline-badge {
top: auto;
bottom: 0px;
left: 43px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="page-header">
<h1>Horizontal timeline</h1>
</div>
<div style="display:inline-block;width:100%;overflow-y:auto;">
<ul class="timeline timeline-horizontal">
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>One</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Two</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Three</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Four</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Five</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Six</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Seven
</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Eight</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
<li class="timeline-item">
<div class="col-md-12 Timline-holder">
<div class="row">
<div class="col-md-6 col-sm-12 Timline-item">
<div class=" Timline-box" data-aos="fade-right">
<h3>Nine</h3>
</div>
<i class=" Timline-icon fa fa-2x fa-lightbulb-o"></i>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>

关于html - Bootstrap 垂直时间轴到水平时间轴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48812778/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com