My current challenge involves wrapping an img
element with a div
. The issue I am facing is that the image is loading to the left of the div
. I have already set the dimensions of the div
to match those of the image, but it still loads incorrectly. I've experimented with various solutions such as adding a vertical-align property to the image, but the closest I got was setting the position of the div
to absolute, which caused it to load under the text next to the image. One workaround could be nesting the image in another div
, but this might not be ideal for SEO purposes.
Image Positioning Issue
HTML Structure
<ul id="UL_1" class="ab-submenu">
<li id="LI_2">
<a class="ab-item" tabindex="-1" href="http://techdigy.com/wp-admin/profile.php" id="A_3"></a>
<div class="avatar-holder" id="DIV_4">
<img alt="" src="http://1.gravatar.com/avatar/95fef2e7b4a23f9cc0439619db1af0a6?s=64&d=identicon&r=G" class="avatar avatar-64 photo" height="64" width="64" id="IMG_5" />
</div><span class="display-name" id="SPAN_6">Andre</span>
</li>
<li id="LI_7">
<a class="ab-item" href="http://techdigy.com/wp-admin/profile.php" id="A_8">Edit My Profile</a>
</li>
<li id="LI_9">
<a class="ab-item" href="http://techdigy.com/wp-login.php?action=logout&_wpnonce=c7d2e50651" id="A_10">Log Out</a>
</li>
</ul>
CSS Styling
#UL_1 {
background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box;
border: 0px none rgb(204, 204, 204);
color: rgb(204, 204, 204);
font: normal 13px/28px sans-serif;
height: auto;
line-height: 28px;
list-style: none;
margin: 0px;
outline: none;
padding: 6px 0px;
position: relative;
text-align: left;
text-shadow: rgb(68, 68, 68) 0px -1px 0px;
transition: none 0s ease 0s;
width: auto;
z-index: 99999;
}
...
#A_8, #A_10 {
background: rgba(0, 0, 0, 0) none repeat scroll 0px 0px / auto padding-box border-box;
border: 0px none rgb(33, 117, 155);
color: rgb(33, 117, 155);
display: block;
font: normal 13px/26px sans-serif;
height: 26px;
line-height: 26px;
list-style: none;
min-width: 140px;
outline: none;
padding: 0px 12px 0px 8px;
text-align: left;
text-decoration: none;
transition: none 0s ease 0s;
white-space: nowrap;
}/*#A_8, #A_10*/