• bootstrap注意事项(七)图片


     

     在本章中,我们将学习 Bootstrap 对图片的支持。Bootstrap 提供了三个可对图片应用简单样式的 class:

     .img-rounded:添加 border-radius:6px 来获得图片圆角。

    .img-circle:添加 border-radius:500px 来让整个图片变成圆形。

    .img-thumbnail:添加一些内边距(padding)和一个灰色的边框。

    <!DOCTYPE HTML>
    <html>
    <head>
    <link rel="stylesheet" href="/stylesheets/bootstrap.min.css">
    </head>
    <body>
    <img src="/course/554b2aa0d7e0396d67b0a556/download02.png"class="img-rounded">
    <img src="/course/554b2aa0d7e0396d67b0a556/download02.png"class="img-circle">
    <img src="/course/554b2aa0d7e0396d67b0a556/download02.png"class="img-thumbnail">
    </body>
    </html>

    响应式图片

    在 Bootstrap 版本 3 中,通过为图片添加 .img-responsive 类可以让图片支持响应式布局。其实质是为图片设置了 max- 100%;、 height: auto; 和 display: block; 属性,从而让图片在其父元素中更好的缩放。

    如果需要让使用了 .img-responsive 类的图片水平居中,请使用.center-block 类,不要用 .text-center。

    SVG 图像和 IE 8-10

    Internet Explorer 8-10 中,设置为 .img-responsive 的 SVG 图像显示出的尺寸不匀称。为了解决这个问题,在出问题的地方添加 100% 9; 即可。Bootstrap 并没有自动为所有图像元素设置这一属性,因为这会导致其他图像格式出现错乱。

    图片形状

    通过为 <img> 元素添加以下相应的类,可以让图片呈现不同的形状。

    跨浏览器兼容性

    请时刻牢记:Internet Explorer 8 不支持 CSS3 中的圆角属性。

    描述
    .img-rounded 为图片添加圆角 (IE8 不支持)
    .img-circle 将图片变为圆形 (IE8 不支持)
    .img-thumbnail 缩略图功能
    .img-responsive 图片响应式 (将很好地扩展到父元素)
  • 相关阅读:
    yii 引入文件
    CodeForces 621C Wet Shark and Flowers
    面试题题解
    POJ 2251 Dungeon Master
    HDU 5935 Car(模拟)
    HDU 5938 Four Operations(暴力枚举)
    CodeForces 722C Destroying Array(并查集)
    HDU 5547 Sudoku(dfs)
    HDU 5583 Kingdom of Black and White(模拟)
    HDU 5512 Pagodas(等差数列)
  • 原文地址:https://www.cnblogs.com/qiuzhimutou/p/4749046.html
Copyright © 2020-2023  润新知