css - Twitter Bootstrap - 响应图像和轮播

标签 css twitter-bootstrap responsive-design carousel

我正在使用最新版本的 Twitter Bootstrap 。

我也在使用 bootstrap-responsive.css。

我希望在该图像的中心有一个图像(作为相框)和一个旋转木马(一个提供 Bootstrap )。但是我希望它们能够响应地调整大小。

我这样做的典型方法是,使轮播具有 position:relative,并简单地重叠到图像上。但是随着主动调整大小,这会导致问题。

对于使用 css 的整个媒体查询来说,这是一个全新的事物,关于如何实现这一点有什么想法吗?

最佳答案

我使用 bootstrap 的 carousel 制作网站是...

<div id = "myCarousel" class = "carousel slide">
      <div class = "carousel-inner">
            <!--each slide goes here-->
            <div class = "item active">
                  <img src = "your image here..." class = "img-responsive">
            </div><!--end itemactive-->
            <div class = "item">
                  <img src = "your image here..." class = "img-responsive">
            </div><!--end itemactive-->
            <!--etc-->
      </div><!--end carousel-inner-->
</div><!--end carouselslide-->

然后在 CSS 中,我会

#myCarousel
{
     background-image:url(your background image path here);
}

#myCarousel.carousel-inner
{
     width: 80%; /*carousel width size here - my example will use 80%, if you want the carousel to fill entire screen, then just remove this width element.*/
     margin-left: auto;
     margin-right: auto;
     /*These two margins are to center the carousel if you set a smaller width. :) */
}

顺便说一句,我使用了 bootstrap.min.css。

关于css - Twitter Bootstrap - 响应图像和轮播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11870625/

相关文章:

html - 针对过渡延迟的特定属性

css - 如何在 Twitter Bootstrap 中将卡住的输入框和提交按钮彼此分开?

javascript - 使用 Zurb Foundation 4 时如何在移动设备上切换到桌面 View ?

html - Bootstrap 模态窗口的问题

html - bootstrap 折叠 div 显示 1 隐藏 1

html - 制作带有副标题的响应式表格

c# - 如何确定设备是否为桌面浏览器?

HTML 输入在 div 中对齐

javascript - 如何使用带有多个按钮的 javascript 更改按钮颜色?

javascript - html中pdf元素的滚动条样式