How to insert image and text in asp: Menu control

I have an asp: Menu control that has four different menu items. Each menu item has a graphical and textual description.

<Items>
    <asp:MenuItem Text="New Authorization Form" Value="default.aspx" NavigateUrl="~/Default.aspx" ImageUrl="~/Images/TextPad.png"></asp:MenuItem>
    <asp:MenuItem Text="Manage My Forms" Value="myrequests.aspx" NavigateUrl="~/MyRequests.aspx" ImageUrl="~/Images/Pencil.png"></asp:MenuItem>
</Items>

My problem is that the icon and the text do not have a spacer between them, and that just looks ugly! Does anyone know how I can make a little fill between the image and the text of the menu item? I looked through all the attributes of the asp: Menu control, but I could not find it for this, but I might just have missed it.

+3
source share
3 answers

I came up with an answer, but that's not what I was hoping for sure. I added style for img tags for my css as follows:

img
{
    padding-right: 5px;
}

, asp: Menu , .

+5

, css , .

0

the image element in the menu is controlled by the class icon, and changing the properties of this class should solve the problem. I set padding-right to 5px on space image and text

0
source

Source: https://habr.com/ru/post/1707892/


All Articles