How do I make my popup image that is fetched from imgur be responsive? -


i'm having trouble making popup-image responsive tried solve many hours no avail can spot issue within code?

https://pastebin.com/5dudjptp

https://jsfiddle.net/mcs29l9p/

please check pastebin or jsfiddle full code

#popup-box  {       display:none;       position:absolute;       //border:solid 1px #f5f5f5;       //background:#fff;       //box-shadow:0 0 10px #666;       left:0;       top:0;       bottom:0;       right:0;       margin:auto;        width: 600px;       height: 600px;           }  #popup-image {     width:100%;      height:auto; } 

first, jsfiddle comes different "editors" css, html , js. please, don't put in html view (see fiddle below example).

for question, hard-code size of #popup-box width , height attributes, why not adapt. 1 simple fix use max-width , max-height instead:

#popup-box {   /* ... */   max-width: 600px;   max-height: 600px; } 

see this fiddle complete example.


as side note: making website responsive lot of work. hopefully, many css frameworks can take care of you: bootstrap, semantic-ui, material name few. if creating production site, suggest switch 1 of them instead of reinventing wheel.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -