Lalita Tana Lalita Tana - 1 year ago 83
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>

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 class="infoboxbody">

css info of 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?

Answer Source

Try using styles for img tag. like,

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

here is a working fiddle -

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download