html - Vertically center align a text on the right side of an image in a div -


i have bunch of image , text side side, both inside div float:right. this how looks now. need vertically center align text beside image (for example text answer). how do that? please suggest.

<div id="content">content here</div>         <div id="navbar">           <br>           <div id ="quesbuildertext">question builder</div> <br>           <div id = "textimage"> <img id="textimg"/></div>           <div id = "texttext"> text answers </div>           <br> <br> <br>           <div id = "multiplechoiceimage"> <img id="multiplechoiceimg"/></div>           <div id = "multiplechoicetext"> multiple choice </div>           <br> <br> <br>           <div id = "dropdownimage"> <img id="dropdownimg"/></div>           <div id = "dropdowntext"> dropdown </div> </div> </div> 

sample css

#navbar {   float: right;   width: 24%;   background-color: white; } #textimg {   width:30%;   max-width: 40px;   height:auto;   margin-left: 20px;   float: left; }  #texttext {   margin-left: 10px;   float: left;   color: #7f7f7f; } 

you can follows. essential part css rule #navbar>div , note deleted lot of other settings , added class .texttext 3 texts (instead of ids):

#navbar {    float: right;    width: 30%;  }    .texttext {    margin-left: 10px;  }    #quesbuildertext {    margin-bottom: 20px;    font-weight: bold;  }    #navbar>div {    display: inline-block;    vertical-align: middle;  }
<div id="content">content here</div>  <div id="navbar">    <br>    <div id="quesbuildertext">question builder</div> <br>    <div id="textimage"> <img src="http://placehold.it/40x30/fb7" id="textimg" /></div>    <div class="texttext"> text answers </div>    <br> <br> <br>    <div id="multiplechoiceimage"> <img src="http://placehold.it/40x30/fb7" id="multiplechoiceimg" /></div>    <div class="texttext"> multiple choice </div>    <br> <br> <br>    <div id="dropdownimage"> <img src="http://placehold.it/40x30/fb7" id="dropdownimg" /></div>    <div class="texttext"> dropdown </div>  </div>


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 -