css - Bootstrap 轮播问题

标签 css twitter-bootstrap

我需要将图像和 Bootstrap 轮播的标题居中对齐

我使用 php 代码显示来自数据库的随机图像

这是我用来保持宽高比的:

<div class="item">';
        while ($resultados = $arte->fetch_assoc()) {
            $title = utf8_encode($resultados['titulo']);
          $id = $resultados['medidas'];
          $tec = utf8_encode($resultados['tecnica']);
          $img = $resultados['imagen'];
          $home .= '  <img src="'.$img.'" style="background-size: cover;background-size: cover;width: auto;height: auto;min-width: 1%;max-height: 600px;max-width: 1000px;">
          <div class="container">
            <div class="carousel-caption">
              <h1>'.$title.'.</h1>
              <p class="lead">'.$id.'<br> '.$tec.'</p>
              <a class="btn btn-large btn-inverse" href="/arte_objeto">Ver m&aacute;s</a>
            </div>
         </div>';
            }
        $home .= '</div>

这是结果:

http://prntscr.com/64h3vb

所以也对齐标题,以便它在旋转木马的中心显示图像

我试过:

background-position: center center;

但是没用

最佳答案

在要居中的 div/图像上使用 margin:0 auto;

使用您的“检查元素”找到向左拉动的 div,然后应用该 css。

关于css - Bootstrap 轮播问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28493439/

相关文章:

html - 使 Glyphicon-plus 纤细且颜色在悬停时不变

jquery - Bootstrap 下拉按钮菜单消失

javascript - Bootstrap 在本地主机上工作,但不在在线服务器上工作

html - 将兄弟组合器与 svg 和 :focus 结合使用

php - 使用php从mysql数据库中获取数据,以所见即所得的形式显示以供编辑

javascript - BLUEPRINT Google Grid Gallery rtl 支持

javascript - Material-ui ToolbarTitle 失去了它的字体系列

css - Bootstrap - 在移动设备上右对齐标题中的图标按钮

css - 为什么我的网页的方向变成横向,当聚焦在文本区域内时缩放变得有趣?

css - 使用 CSS 匹配空输入框