我正在制作手风琴,作为手风琴的一部分,我必须在每次折叠的右侧放一个箭头。不幸的是,我看不到它,但它仍然存在。我不知道是否有任何样式问题。谁能指出我要去哪里错了?
我已经在这里附加了我的代码。请仔细检查。
HTML
<div class="card">
<div class="card-header" id="headingOne">
<h5>
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Collapsible Group Item #1
</button>
</h5>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#nb-accordionExample">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingTwo">
<h5>
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Collapsible Group Item #2
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#nb-accordionExample">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingThree">
<h5>
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
Collapsible Group Item #3
</button>
</h5>
</div>
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#nb-accordionExample">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
SCSS
.nb-accordion {
.card-header {
background: #333;
padding: 0;
border-bottom: 1px solid #3E3E3E;
border-radius: 0 !important;
}
.card {
display: block;
background-color: #fdf03b;
border-radius: 0;
color: #333;
border: none;
}
.btn {
display:block;
border: 1px solid transparent;
border-radius: 0;
padding: 20px;
width: 100%;
text-align: left;
text-decoration: none;
color: #fff;
&::after {
content: '';
display: inline-block;
background: url(../images/downwards-pointer.svg) no-repeat;
position: absolute;
top: 0;
right: 10px;
bottom: 0;
left: auto;
margin: auto;
height: 20px;
width: 20px;
z-index: 50;
}
}
.card-body {
display: block;
padding: 20px;
}
}
答案 0 :(得分:0)
我认为是因为您的svg位置
.nb-accordion {
.card-header {
background: #333;
padding: 0;
border-bottom: 1px solid #3E3E3E;
border-radius: 0 !important;
}
.card {
display: block;
background-color: #fdf03b;
border-radius: 0;
color: #333;
border: none;
}
.btn {
display:block;
border: 1px solid transparent;
border-radius: 0;
padding: 20px;
width: 100%;
text-align: left;
text-decoration: none;
color: #fff;
&::after {
content: '';
display: inline-block;
background: url(../images/downwards-pointer.svg) no-repeat; //HERE
position: absolute;
top: 0;
right: 10px;
bottom: 0;
left: auto;
margin: auto;
height: 20px;
width: 20px;
z-index: 50;
}
}
.card-body {
display: block;
padding: 20px;
}
}
答案 1 :(得分:0)
在文本编辑器中打开图像svg
文件,然后复制代码并按以下方式编写。
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30'><circle cx='15' cy='15' r='10' /></svg>") no-repeat;
我希望这会成功!
答案 2 :(得分:0)
添加包装.nb-accordion
和.card-header
添加position: relative;
.nb-accordion .card-header {
background: #333;
padding: 0;
border-bottom: 1px solid #3E3E3E;
border-radius: 0 !important;
position: relative;
}
.nb-accordion .card {
display: block;
background-color: #fdf03b;
border-radius: 0;
color: #333;
border: none;
}
.nb-accordion .btn {
display: block;
border: 1px solid transparent;
border-radius: 0;
padding: 20px;
width: 100%;
text-align: left;
text-decoration: none;
color: #fff;
}
.nb-accordion .btn::after {
content: '';
display: inline-block;
background: url(https://cdns.iconmonstr.com/wp-content/assets/preview/2017/240/iconmonstr-arrow-65.png) no-repeat;
background-size: cover;
position: absolute;
top: 0;
right: 10px;
bottom: 0;
left: auto;
margin: auto;
height: 20px;
width: 20px;
z-index: 50;
}
.nb-accordion .card-body {
display: block;
padding: 20px;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" >
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<div class="nb-accordion">
<div class="card">
<div class="card-header" id="headingOne">
<h5>
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Collapsible Group Item #1
</button>
</h5>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#nb-accordionExample">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingTwo">
<h5>
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Collapsible Group Item #2
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#nb-accordionExample">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingThree">
<h5>
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
Collapsible Group Item #3
</button>
</h5>
</div>
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#nb-accordionExample">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
</div>