css - How do I center an absolute-positioned image with percentage width? -


i have image following css:

element.style {     right: 50%;     margin-right: -220px;     top: 31%;     width: 440px;     position: absolute; } 

i need change width set in percent instead(35.4%). can still center , keep position absolute?

of course, if want same way above use 35.4/2 = 17.7 margin (demo):

element.style {     right: 50%;     margin-right: -17.7%;     top: 31%;     width: 35.4%;     position: absolute; } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -