i am having a simple csss menu, where it contains background images aligned to left, and i want text to float left of image too.
html:
<div class='mmenu'><ul><li><a id="li6" class="menu-news" href= "viewNews.php" >News</a></li></ul></div>
css:
.mmenu{
height: fit-content;
width: fit-content;
float: left;
position: fixed;
}
.mmenu ul
{
margin-top: 20px;
margin-left: 15px;
}
.mmenu li
{
margin-bottom: 0px;
width: 150px;
color: white;
}
.mmenu a {
font-size:14px;
font-family: Arial, sans-serif;
font-style: normal;
font-weight:bold;
display: block;
padding-top:12px;
padding-bottom: 7px;
text-align:left;
padding-right: 12px;
padding-left: 15px;
position: relative;
}
.menu-news{
background-image:url('menu icons/css-sprite.png');
background-repeat: no-repeat; background-position:5px 17px;
}
the problem now, is that menu text is floating above the image, so how to make space between the image and the text
If I understand you correctly, you could add padding to the
menu-newsclass, to push the text so that it doesn’t lay on top of the image in the background.