如何在css中添加图像
.element {
background-image: url("imageFile.png");
}
css更改图像宽度
/*Search Term: "CSS change image width"*/
img {
width: /*Add width here*/;
}
/*Example*/
img {
width: 200px;
}
css图像大小调整
squareImage {
border: 1px solid #ddd; /* thickness and color of border */
border-radius: 4px; /* edge rounding of border */
width: 150px; /* width of image (px or % or auto) */
height: auto; /* height of image (px or % or auto) */
}
图像大小css
img {
width: width;
height: height;
}
html背景图片适合屏幕
body {
background-position: center;
background-repeat: no-repeat;
background-size: contain;
}