html - Cannot center a fluid image in a fluid Div -


i'm having issue horizontally centering fluid image in fluid div. looking high , low, solutions others have found not working me, either i'm trying hard (i doubt it) or i'm working different medium.

html:

<body>   <div id="backgrouddiv">     <img src="images/numbertwo.png" alt="" id="fsbg"/>   </div> </body> 

css:

body {     margin: 0px } #fsbg {     width: auto;     height: 100%;     min-width: 1040px;     position: absolute;     min-height: 585px; } #backgrouddiv {     width: 100%;     height: 1080px;     text-align: center;     display: block;     background-color: #bf2527;     top: 0px;     left: 0px;     right: 0px;     bottom: 0px; } 

"margin: auto" nothing width of variable. in code is, left edge of image "numbertwo" centered on page. want center of image centered. behaves should scaling-wise, not in middle of page!

any appreciated, it's been driving me wall. let me know if more information needed.

h

you need remove position: absolute; in img:

#fsbg {     width: auto;     height: 100%;     min-width: 1040px;     min-height: 585px; } 

demo: https://jsfiddle.net/3w5rqg3d/1/


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -