html - CSS Fluid Image issue -
my background of site responsive , works great.but i'm having issues images. want them "fixed" in same position background no matter resolution,. example re-sizing browser 990px 537px 990px 270px image never moved because width/height expand or contract depending on resolution of browser.
good news figured css make width of image fluid background! bad news if make height 100% or 14%, height looks same. true need specificity height? why not width? how?
#block-imageblock-4{ width:26%; height:14%; margin-top:7%; margin-bottom:1%; margin-left:37%; margin-right:36.5%; max-width:100%; max-height:100%; }
so question how show image in same position on screen if resolution large or small? please provide example , not link. said figured out make width of image fluid, not height if have better way please share.
i'm using drupal build site fyi.
<---------------------------------------------edit---------------------------------------->
here 2 example of talking about. please ignore images image labeled image1.
css image1:
#block-imageblock-4{ width:26%; height:14%; margin-top:7%; margin-bottom:1%; margin-left:37%; margin-right:36.5%; max-width:100%; max-height:100%; }
first image- browser resolution: 480px 356px
second image- browser resolution: 520px 630px
the code in js fiddle: jsfiddle
here how did css:
html { background-color: black; } #master { position: relative; } #img { width: 23%; max-width: 120px; display: inline-block; background-color: red; position: absolute; bottom: 80%; height: 10%; max-height: 40px; margin-top: -80px; left: 50%; margin-left: -40px; }
html:
<div id="master"> </div> <div id="img"> </div>
you make outer div ie master set relative position image give properties mentioned edit width , height according image size have, , edit margin-top , margin-left offset fit position wish, , work fluidly, hope helps.
as editing bottom:x%; (percentage number in x) edit position in y-axis.
Comments
Post a Comment