body {
background: lightblue url(“img_tree.gif”) no-repeat fixed center;
}
หรือ
min-width: 950px;
word-wrap: break-word;
background-image: url(http://plasmats.com/wp-content/themes/mchome/images/solidwork.jpg);
background-position: 150px 750px;
background-repeat: no-repeat;
background-position: center;
background-attachment: fixed;
หรือ
background-image: url(path-to-file/img.jpg);
background-repeat:no-repeat;
background-position: center center;
.yourclass {
background: url(image.png) no-repeat center /cover;
}
.yourclass {
background-image: url(image.png);
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
o vertically center:
#con {
background: url(image.jpg) no-repeat left center;
}
To horizontally center:
#con {
background: url(image.jpg) no-repeat center top;
}
#somediv {
background: url (image.jpg) no-repeat 50% 50%;
}
the 50% centers it horizontally and vertically.. alternatively you can use center center