ยังไงเพื่อเพิ่มภาพใน 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;
}