javascript - Autofit Div Background Image -


i want set div background image fit in div size. trying lot google help. not able solution.

my div property below

userpic.style.width = "65px"; userpic.style.height = "85px"; userpic.style.position = "absolute"; userpic.style.left = "10px"; userpic.style.top = "10px"; userpic.style.borderradius = '4em'; 

now setting backround image below

userpic.style.background = "url('"+employee.profilepic+"') no-repeat"; userpic.classname = "profilepic"; 

and set profilepic class below

.profilepic {     background-size: 100%;     background-repeat: no-repeat;     overflow: hidden;     margin:auto; } 

but background-size:100% not working in chrome , not working perfectly. have div of size 65x85 , image size more this. how fit large or small image in div?

i try background-size: cover; , see if gets desired effect you're after.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -