gpt4 book ai didi

jquery - 如何在 jquery 框内居中标记 i

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

我有这个图标 fa fa-long-arrow-right 我希望它们在我的 div 中居中。我怎样才能做到这一点?可以用 bootstrap 完成吗?

jQuery(document).ready(function($) {
//portfolio - show link
$('.fdw-background').hover(
function() {
$(this).animate({
opacity: '1'
});
},
function() {
$(this).animate({
opacity: '0'
});
}
);
});
.tiles_border {
border: 1px #ffffff solid;
border-radius: 6px;
}

.fdw-background {
background-color: rgba(0, 0, 0, 0.6);
opacity: 0;
width: 100%;
height: 100%;
border: 1px #ffffff solid;
border-radius: 6px;
cursor: pointer;
}

.fdw-background h2 {
font-weight: 700;
font-family: 'Dosis', sans-serif;
text-align: center;
color: #FFF;
}

.fdw-background p {
text-align: center;
color: #fff;
font-size: 20px;
}

.fdw-background .fdw-port {
text-align: center;
padding: 0 40px 0;
}

.fdw-background .fdw-port a {
padding: 8px 15px;
font-size: 1em;
}


/*subtitle*/

.fdw-subtitle {
font-size: 0.8em;
margin-top: -20px;
color: #0CF;
}

.fdw-subtitle a {
color: #F90;
}

#koncerty {
background-image: url("http://placehold.it/400x550");
height: 400px;
background-repeat: no-repeat;
background-size: cover;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://use.fontawesome.com/62cf094036.js"></script>
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-12">
<div id="koncerty" class="tiles_border">
<div style="opacity: 0;" class="fdw-background atrakcje-tekst">
<h2>KONCERTY</h2>
<br>

<p>Na targach wystąpią:
<br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Andre</i> <br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Bobi</i> <br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Kosmokwaki</i>
</p>
</div>
</div>

</div>
</div>
</div>

最佳答案

您可以首先使用两种方法是在包含图标的 div 上使用 bootstrap col-offset-4 类,这将为您提供 4 列空白请注意,您的 div 中的类从 col-md-6 更改为 col-md-offset-4

<div class="col-md-offset-4 col-sm-12">
<div id="koncerty" class="tiles_border">
<div style="opacity: 0;" class="fdw-background atrakcje-tekst">
<h2>KONCERTY</h2>
<br>

<p>Na targach wystąpią:
<br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Andre</i> <br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Bobi</i> <br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Kosmokwaki</i>
</p>
</div>
</div>

</div>

另一种方法是使用 col-md-12 设置全宽列并使用 text-center 类将图标居中

<div class="col-sm-12 text-center">
<div id="koncerty" class="tiles_border">
<div style="opacity: 0;" class="fdw-background atrakcje-tekst">
<h2>KONCERTY</h2>
<br>

<p>Na targach wystąpią:
<br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Andre</i> <br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Bobi</i> <br>
<i class="fa fa-long-arrow-right" aria-hidden="true">Kosmokwaki</i>
</p>
</div>
</div>

</div>

关于jquery - 如何在 jquery 框内居中标记 i,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42476249/

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