Reputation: 1565
I would like to vertically align the icon on the following screenshot with the other elements :
I was wondering if I could find a little fix without changing the html structure (I didn't develop that code, I am just debugging). I tried with the vertical-align:middle
property but I didn't manage to fix it.
li {
display: inline-block;
list-style: outside none none;
margin: 0px 0px 11px;
padding: 0px;
}
label {
width:200px;
float:left;
padding:8px;
}
select {
border: 1px solid #CBCBCB;
float: left;
padding: 5px;
width: 318px;
color: #4F4E4E;
font-family: lucida sans unicode;
}
<ul>
<li>
<label for="1_selectLangue">
Langue
<span style="color:red">*</span>
</label>
<select id="1_selectLangue"></select>
<a id="boutonLangue">
<img src="ic_enter.png"/>
</a>
</li>
</ul>
JSFiddle : https://jsfiddle.net/aghvyhto/2/
Upvotes: 0
Views: 928
Reputation: 126
Try this
li {
display: table;/* change display to table */
list-style: outside none none;
margin: 0px 0px 11px;
padding: 0px;
}
label {
width:200px;
float:left;
padding:8px;
}
select {
border: 1px solid #CBCBCB;
float: left;
padding: 5px;
width: 318px;
color: #4F4E4E;
font-family: lucida sans unicode;
}
<ul>
<li>
<label for="1_selectLangue">
Langue
<span style="color:red">*</span>
</label>
<select id="1_selectLangue"></select>
<!--add following style to your anchor tag-->
<a id="boutonLangue" style="display:table-cell;vertical-align:middle">
<img src="ic_enter.png"/>
</a>
</li>
</ul>
Upvotes: 1
Reputation: 1728
You can add
#boutonLangue>img{
position:absolute;
margin-top: 6px;
}
to your css and it should push the img a little bit down. Here is your modified fiddle.
Upvotes: 1
Reputation: 489
Use display: inline-block;
and vertical-align: middle;
as well as remove float: left;
on both label and select.
ul {
width:800px;
}
li {
display: inline-block;
list-style: outside none none;
margin: 0px 0px 11px;
padding: 0px;
}
label {
width:200px;
/*float: left;*/ /* Remove this. */
padding:8px;
}
select {
border: 1px solid #CBCBCB;
padding: 5px;
/*float: left;*/ /* Remove this. */
width: 318px;
color: #4F4E4E;
font-family: lucida sans unicode;
}
/* Add the following styles. */
li > * {
display: inline-block;
vertical-align: middle;
}
<ul>
<li>
<label for="1_selectLangue">
Langue
<span style="color:red">*</span>
</label>
<select id="1_selectLangue"></select>
<a id="boutonLangue">
<img src="ic_enter.png"/>
</a>
</li>
</ul>
Upvotes: 1