Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在我的情况下,如何设置图像响应_Javascript_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript 在我的情况下,如何设置图像响应

Javascript 在我的情况下,如何设置图像响应,javascript,html,css,twitter-bootstrap,Javascript,Html,Css,Twitter Bootstrap,我有一个小的图像,但我仍然需要它的反应 我使用bootstrap和img responsive类 <img class='col-lg-1 col-md-1 col-sm-1 img-responsive' id='ball' src='/ball.png'/> 我的问题是,即使我使用了col-lg-1,球在我的屏幕上仍然非常大。我希望它比col-lg-1小,但不知道如何在引导中实现。有人能帮我吗?非常感谢 您需要编写一些CSS /* replace "@screen-lg-m

我有一个小的图像,但我仍然需要它的反应

我使用bootstrap和
img responsive

<img class='col-lg-1 col-md-1 col-sm-1 img-responsive' id='ball' src='/ball.png'/>


我的问题是,即使我使用了
col-lg-1
,球在我的屏幕上仍然非常大。我希望它比
col-lg-1
小,但不知道如何在引导中实现。有人能帮我吗?非常感谢

您需要编写一些CSS

/* replace "@screen-lg-min" with "1200px" if you're not using .less directly. */
@media (min-width: @screen-lg-min) { 
    #ball { max-width: 100px; } /* or whatever size you need. */
}

您可以尝试创建自己的类,然后使用Sass断点mixin,如下所示:

.myImg {
    img {
    position:absolute;
    left: 0px;
    top: 0;
    right: 0;
    bottom: 0;
    @include respondto(phone, tablet) {
    min-width:30px;
    max-width:50px;}

只需将参数更改为您需要的大小。

因此,当屏幕尺寸变小时,您基本上希望图像变小?img responsive类将图像缩放到其父级。家长是如何衡量的?