【问题标题】:carousel image in big screen大屏幕中的轮播图像
【发布时间】:2015-05-09 01:10:50
【问题描述】:

我刚刚使用带有流体容器的 Bootstrap 框架部署了一个网站 现在我遇到了问题。当我在分辨率> 1700px(如1920)的大屏幕上打开主页时,轮播中的图像被挤压和拉伸。

如何让轮播以所有分辨率显示而不会出现图像问题(保持良好的比例)。

/* GLOBAL STYLES
-------------------------------------------------- */
/* Padding below the footer and lighter body text */

body {
  padding-bottom: 40px;
  color: #5a5a5a;

}


/* CUSTOMIZE THE NAVBAR
-------------------------------------------------- */

/* Special class on .container surrounding .navbar, used for positioning it     into place. */
.navbar-wrapper {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
}

/* Flip around the padding for proper display in narrow viewports */
.navbar-wrapper > .container {
  padding-right: 0;
  padding-left: 0;
}
.navbar-wrapper .navbar {
  padding-right: 15px;
  padding-left: 15px;
}
.navbar-wrapper .navbar .container {
  width: auto;
}


/* CUSTOMIZE THE CAROUSEL
-------------------------------------------------- */
/* wen bi bayen l div l */
/* Carousel base class */
.carousel {

  height: 300px;
  margin-bottom: 60px;
}
/* Since positioning the image, we need to help out the caption */
.carousel-caption {
  z-index: 10;
}

/* Declare heights because of positioning of img element */
.carousel .item {
  height: 350px;
  background-color: #777;
}
.carousel-inner > .item > img {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 100%;
  height: 350px;
}


/* MARKETING CONTENT
-------------------------------------------------- */

/* Center align the text within the three columns below the carousel */
.marketing .col-lg-4 {
  margin-bottom: 20px;
  text-align: center;
}
.marketing h2 {
  font-weight: normal;
}
.marketing .col-lg-4 p {
  margin-right: 10px;
  margin-left: 10px;
}


/* Featurettes
------------------------- */

.featurette-divider {
  margin: 80px 0; /* Space out the Bootstrap <hr> more */
}

/* Thin out the marketing headings */
.featurette-heading {
  font-weight: 300;
  line-height: 1;
  letter-spacing: -1px;
}


/* RESPONSIVE CSS
-------------------------------------------------- */

@media (min-width: 768px) {
  /* Navbar positioning foo */
  .navbar-wrapper {
    margin-top: 20px;
  }
  .navbar-wrapper .container {
    padding-right: 15px;
    padding-left: 15px;
  }
  .navbar-wrapper .navbar {
    padding-right: 0;
    padding-left: 0;
  }

  /* The navbar becomes detached from the top, so we round the corners */
  .navbar-wrapper .navbar {
    border-radius: 4px;
  }

  /* Bump up size of carousel content */
  .carousel-caption p {
    margin-bottom: 20px;
    font-size: 21px;
    line-height: 1.4;
  }

  .featurette-heading {
    font-size: 50px;
  }
}

@media (min-width: 992px) {
  .featurette-heading {
    margin-top: 120px;
  }
}

【问题讨论】:

  • 如果我理解这个问题很好,这就是我的解决方案:我为避免此类问题所做的是设置,例如 width:100%height:auto; 在这种情况下,图像不会被拉伸并且挤压。
  • 感谢 vinc 我会试试的

标签: html twitter-bootstrap carousel


【解决方案1】:

试试

background-size:cover;

在你的 CSS 上。

【讨论】:

  • 请扩展您的答案。它应该应用于什么,为什么要应用它?通常只需提供更多关于您的答案的细节,以使其比巧克力茶壶更有用。
猜你喜欢
  • 2017-07-03
  • 1970-01-01
  • 2015-09-14
  • 1970-01-01
  • 2019-06-21
  • 1970-01-01
  • 1970-01-01
  • 2015-03-22
  • 1970-01-01
相关资源
最近更新 更多