Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.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
调整图像大小html/css_Css_Html_Image_Resize - Fatal编程技术网

调整图像大小html/css

调整图像大小html/css,css,html,image,resize,Css,Html,Image,Resize,我在facebook应用程序中有几张图片。问题是图像很大,无论是通过电脑还是电话访问,我都需要它看起来很好。考虑到不同的屏幕尺寸,将其设置为某个固定尺寸显然会使其看起来很糟糕。 那么,我应该如何调整它的大小,使它在任何屏幕上都看起来很好?将img标签上的宽度和高度设置为百分比(其容器的百分比): 根据需要调整百分比。将img标签上的宽度和高度设置为(容器的)百分比: 根据需要调整百分比。试试这个 img { width:100%;/*adjust this value to

我在facebook应用程序中有几张图片。问题是图像很大,无论是通过电脑还是电话访问,我都需要它看起来很好。考虑到不同的屏幕尺寸,将其设置为某个固定尺寸显然会使其看起来很糟糕。

那么,我应该如何调整它的大小,使它在任何屏幕上都看起来很好?

img
标签上的宽度和高度设置为百分比(其容器的百分比):



根据需要调整百分比。

img
标签上的宽度和高度设置为(容器的)百分比:


根据需要调整百分比。

试试这个

 img
 {
    width:100%;/*adjust this value to your needs*/
    max-width: the size of the image;/* so it wont get bigger and pixelated*/
    height:auto;
 }
如果可能,另一个选项是使用媒体查询,因此对于不同的浏览器大小,可以加载不同大小的图像

下面是一个示例,看看这是否就是您想要实现的目标

 img
 {
    width:100%;/*adjust this value to your needs*/
    max-width: the size of the image;/* so it wont get bigger and pixelated*/
    height:auto;
 }
如果可能,另一个选项是使用媒体查询,因此对于不同的浏览器大小,可以加载不同大小的图像

下面是一个示例,以查看这是否是您试图实现的

使用媒体查询。 e、 g:

使用媒体查询。 e、 g:


是图像内容还是界面的一部分?是内容的一部分,是列表元素是图像内容还是界面的一部分?是内容的一部分,是列表元素
 @media all and (min-width: 1001px) {
  img {
    width: 100%; /* insert prefered value */
    height: auto;
  }
}

@media all and (max-width: 1000px) and (min-width: 700px) {
  img {
    width: 100%; /* insert preferred value */
    height: auto;
  }
}

@media all and (max-width: 699px) and (min-width: 520px), (min-width: 1151px) {
  img {
    width: 100%; /* insert preferred value */
    height: auto;
  }
}