gpt4 book ai didi

html - 如何在图标之间创建垂直线(同时使用带有 html 元素的 Bootstrap 列类)

转载 作者:太空宇宙 更新时间:2023-11-04 13:07:40 25 4
gpt4 key购买 nike

我正在尝试在两个图标之间设置边界线,如下图所示。 enter image description here

我正在使用 Bootstrap 框架并编写了以下代码来实现它。

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head
content must come *after* these tags -->
<title>Border</title>
<!-- Bootstrap -->
<link href="./bootstrap.min.css" rel="stylesheet">
<link href="./bootstrap-theme.min.css" rel="stylesheet">
<link href="./font-awesome.min.css" rel="stylesheet">
<link href="./bootstrap-social.css" rel="stylesheet">
<style>

body{
background-color:lightgrey;
}

#div1{
background-color:white;
}

.timeline {
position: relative;
margin: 10px 0;
padding: 0;
list-style: none;
counter-reset: section;
}
.timeline:before {
content: '';
position: absolute;
top: 0;
bottom: 0;
width: 3px;
background: #fdb839;
left: 32px;
margin: 0;
border-radius: 2px;
}
.timeline > div {
position: relative;
margin-right: 10px;
margin-bottom: 50px;
padding-top: 18px;
box-sizing: border-box;
padding-left: 90px;
}
.timeline > div:before,
.timeline > div:after {
display: block;
}

.timeline > div:before {
counter-increment: section;
content: counter(section);
background: #fdb839;
width: 70px;
height: 70px;
position: absolute;
top: 0;
border-radius: 50%;
left: -1px;
display: flex;
justify-content: center;
align-items: center;
color: #Fff;
font-size: 22px;
font-weight: bold;
border: 15px solid #fff;
box-sizing: border-box;
}
.timeline > div:after {
clear: both;
}


</style>
</head>

<body>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-11 col-sm-offset-1">
<form class="form-horizontal" role="form" id="form1">

<div id="div1" class="form-group">
<div class="timeline">
<div class="col-xs-12 col-sm-9 col-sm-offset-2">
<br>
<p>
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</p>
<br>
</div>
<div class="col-xs-12 col-sm-9 col-sm-offset-2">
<br>
<p>
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</p>
<br>
</div>
<div class="col-xs-12 col-sm-9 col-sm-offset-2">
<br>
<p>
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</p>
<br>
</div>
<div class="col-xs-12 col-sm-9 col-sm-offset-2">
<br>
<p>
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</p>
<br>
</div>
<div class="col-xs-12 col-sm-9 col-sm-offset-2">
<br>
<p>
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</p>
<br>
</div>
<div class="col-xs-12 col-sm-9 col-sm-offset-2">
<br>
<p>
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</p>
<br>
</div>
</div>
</div>

<!--</div>-->
</form>
</div>
</div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="./bootstrap.min.js"></script>
</body>
</html>

我无法获得两个图标之间的界线。但是,当我使用不带列类的 div 元素时,它工作得非常好。但是,我建议将列类与 Bootstrap 框架一起使用。我将如何实现同样的目标?

最佳答案

  1. 我使用了带有彩色左边框和伪元素的简单 Bootstrap 布局。

  2. 您可以添加嵌套的列和图像。

two columns with images

一栏图片

当屏幕宽度为 767px 或更小时,图像会彼此重叠放置。

jsfiddle

@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');

body {
background: lightgrey;
}

.timeline {
background: white;
counter-reset: section;
margin: 20px auto;
padding-left: 70px;
padding-top: 50px;
}

.timeline .col-xs-12 {
border-left: solid 4px orange;
padding-bottom: 80px;
padding-left: 40px;
padding-right: 60px;
}

.timeline .col-xs-12:before {
/* counter */
counter-increment: section;
content: counter(section);
/* position */
position: absolute;
left: -22px; /* = (width + border-left) / 2 */
top: -30px;
/* form & size */
border-radius: 50%;
height: 40px;
width: 40px;
/* colors & text */
background: orange;
color: white;
font-size: 22px;
font-weight: bold;
line-height: 40px;
text-align: center;
}


/* images */
.timeline img {
margin-top: 20px;
width: 100%;
}
<div class="container timeline">
<div class="row">
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
<div class="row">
<div class="col-sm-6"><img src="https://via.placeholder.com/900x300/c69/f9c/?text=First" alt=""></div>
<div class="col-sm-6"><img src="https://via.placeholder.com/900x300/9c6/cf9/?text=Second" alt=""></div>
</div>
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
</div>
</div>

两列图片

当屏幕宽度为:

  • 480px 或更小
  • 768px991px

jsfiddlecodepen

@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css');

body {
background: lightgrey;
}

.timeline {
background: white;
counter-reset: section;
margin: 20px auto;
padding-left: 70px;
padding-top: 50px;
}

.timeline .col-xs-12 {
border-left: solid 4px orange;
padding-bottom: 80px;
padding-left: 40px;
padding-right: 60px;
}

.timeline .col-xs-12:before {
/* counter */
counter-increment: section;
content: counter(section);
/* position */
position: absolute;
left: -22px; /* = (width + border-left) / 2 */
top: -30px;
/* form & size */
border-radius: 50%;
height: 40px;
width: 40px;
/* colors & text */
background: orange;
color: white;
font-size: 22px;
font-weight: bold;
line-height: 40px;
text-align: center;
}

/* images */
.timeline img {
margin-top: 20px;
width: 100%;
}
@media (max-width: 480px) {
.col-xs-6 {
width: 100% !important;
}
}
<div class="container timeline">
<div class="row">
<div class="col-sm-6">
<div class="row">
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
<div class="row">
<div class="col-xs-6 col-sm-12 col-md-6"><img src="https://via.placeholder.com/900x300/c69/f9c/?text=First" alt=""></div>
<div class="col-xs-6 col-sm-12 col-md-6"><img src="https://via.placeholder.com/900x300/9c6/cf9/?text=Second" alt=""></div>
</div>
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
</div>
</div>

<div class="col-sm-6">
<div class="row">
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
<div class="row">
<div class="col-xs-6 col-sm-12 col-md-6"><img src="https://via.placeholder.com/900x300/69c/9cf/?text=Three" alt=""></div>
<div class="col-xs-6 col-sm-12 col-md-6"><img src="https://via.placeholder.com/900x300/96c/c9f/?text=Four" alt=""></div>
</div>
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
<div class="col-xs-12">
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.
</div>
</div>
</div>
</div>
</div>

关于html - 如何在图标之间创建垂直线(同时使用带有 html 元素的 Bootstrap 列类),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38420349/

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