gpt4 book ai didi

jquery - 垂直对齐 Superslides 中的内容

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

我正在尝试在网站上同时使用 Superslides ( https://github.com/nicinabox/superslides/) 和 Boostrap 3。

它似乎工作得很好,但我需要帮助来垂直对齐我的文本内容。我试过绝对位置和固定位置,但似乎没有任何效果。

当每张幻灯片的内容高度不同时,我应该如何垂直对齐我的容器?

现在的样子:http://jsfiddle.net/2P3zL/

我的 html:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Slides</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="http://nicinabox.com/superslides/dist/stylesheets/superslides.css">


</head>
<body>
<div id="slides">
<ul class="slides-container">


<li>
<img src="http://nicinabox.com/superslides/images/girl.jpg" alt="">
<div class="container">
<div class="row">
<div class="col-xs-6 col-xs-offset-3">
<div class="well">
<p>Text 1</p>
</div>
</div>
</div>
</div>
</li>


<li>
<img src="http://nicinabox.com/superslides/images/building.jpg" alt="">
<div class="container">
<div class="row">
<div class="col-xs-6 col-xs-offset-3">
<div class="well">
<p>Text 2</p>
</div>
</div>
</div>
</div>
</li>


<li>
<img src="http://nicinabox.com/superslides/images/floor-kid.jpg" alt="">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="well">
<h1>Heading 3</h1>
</div>
</div>
</div>

<div class="row">
<div class="col-xs-6">
<div class="well">
<table class="table">
<tbody>
<tr>
<td>Table:</td>
<th class="text-right">1</th>
</tr>
<tr>
<td>Table:</td>
<th class="text-right">2</th>
</tr>
<tr>
<td>Table:</td>
<th class="text-right">3</th>
</tr>
<tr>
<td>Table</td>
<th class="text-right">4</th>
</tr>
<tr>
<td>Table</td>
<th class="text-right">5</th>
</tr>

</tbody>
</table>
</div>
</div>
<div class="col-xs-6">
<div class="well">
<table class="table">
<tbody>
<tr>
<td>Table:</td>
<th class="text-right">6</th>
</tr>
<tr>
<td>Table</td>
<th class="text-right">7</th>
</tr>
<tr>
<td>Table</td>
<th class="text-right">8</th>
</tr>
<tr>
<td>Table</td>
<th class="text-right">9</th>
</tr>
<tr>
<td>Table</td>
<th class="text-right">10</th>
</tr>

</tbody>
</table>
</div>
</div>
</div>
</li>

</ul>
</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://nicinabox.com/superslides/javascripts/jquery.easing.1.3.js"></script>
<script src="http://nicinabox.com/superslides/javascripts/jquery.animate-enhanced.min.js"></script>
<script src="http://nicinabox.com/superslides/dist/jquery.superslides.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$( document ).ready(function() {
$('#slides').superslides({
animation: 'fade',
play: 7000,
pagination: true
});
});


</script>
</body>
</html>

最佳答案

CSS下方添加:

.container{
display:table;
width:100%;
height:100%;
}
.container .row{
display:table-cell;
vertical-align:middle;
}

Fiddle


Fiddle回应评论/Fullscreen

关于jquery - 垂直对齐 Superslides 中的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22067907/

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