html - How to get my image responsive within the header?? -


i can't life of me image behave how like. image should sit vertically within parent div (header) , responsive. want whole thing remain in proportion @ moment isn't happening. can please help?

#headbar{  	background-color: #88a6cb;      height: 10%;      width: 100%;      position: fixed;      top: 0px;      text-align: center;  }      #menubutton{  	height: 70%;      float: right;       padding-right: 5%;      margin:auto;      vertical-align: middle;      }
<div id="headbar">  		<a href="javascript:reversedisplay('dropmen')">  		<img id="menubutton" src="https://lh3.ggpht.com/xkkfmevjtydntd5e0xesssv1fukxnfumvxrpmdxgz56ev5wppggprpfei_2auxfmbd4=w300"/>  		</a>  		</div>

you use top transform. top position circle @ 50% height of it's parent, translatey position relative itself, -50% of circles height:

#menubutton{     height: 70%;     float: right;      padding-right: 5%;     margin:auto;     vertical-align: middle;     position: relative;     top: 50%;      -moz-transform: translatey(-50%);     -webkit-transform: translatey(-50%);     -o-transform: translatey(-50%);     -ms-transform: translatey(-50%);     transform: translatey(-50%); } 

jsfiddle

note: http://caniuse.com/#feat=transforms2d


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -