Lalita Tana Lalita Tana - 2 months ago 13
CSS Question

how can i attach an icon near H1 tag?

I have few menus with titles, and next to them attached icons, the following code is working correctly:

<div class="contentcont">
<div class="content">
<div class="navbar">
<a class="navbar" href="index.htm">
<img src="navhome.png" alt="Home" height="12" width="14"></a>
<a class="navbar" href="index.htm">Login</a>
<div class="clear">&nbsp;</div>
</div>


when trying to add the same icon next to a different class it is showing the icon above (if written above) or under (if written under) but no on the same line, i have tried to change:



<div class="infoboxheader infoboxheaderuser">
<img src="navhome.png" alt="Home" height="12" width="14"></a>
<h1 class="infobox">Login to Real Estate</h1>
</div>
<div class="infoboxbody">


css info of infobox:

h1.infobox{
color: #5d5d5d;
font-size: 13px;
font-weight: bolder;
padding-left: 10px;
margin: 0px 0px 0px 0px;
text-transform: uppercase;
}


notice that's a different class, what am i doing wrong?

ASR ASR
Answer

Try using styles for img tag. like,

.infoboxheader img{float:left;margin-top:2px}

here is a working fiddle - https://jsfiddle.net/t8tokcth/1/

Comments