Customize the appearance of an ASP link button within a navigation menu

Just getting started with ASP.net and CSS, I want to customize my link button using CSS similar to other <a href> buttons, but I seem to be running into some issues.

This is the code for my menu:

 <div id="templatemo_menu">
            <ul>
                <li><a href="#"><span>Reconciliation</span></a>
                    <ul>
                        <li>
                            <asp:LinkButton ID="MyLink" runat="server" OnClick="MyLink_Click" Text="Double Entry Per Total Expired"></asp:LinkButton>
                        </li>      
                    </ul>
                </li>
                <li><a href="#"><span>Reports</span></a>
                    <ul>
                        <li><a href="ReportPages.aspx"><span>Report Generation</span></a></li>
                        <li><a href="PrendaDEPage.aspx"><span>Upload Prenda</span></a></li>
                        <li><a href="NavFilesPage.aspx"><span>Navision Uploader</span></a></li>
                    </ul>
                </li>
                <li><a href="#" class="last"><span>Maintenance</span></a>
                    <ul>
                        <li><a href="UsersMaintenancePage.aspx"><span>Report Matrix</span></a></li>
                        <li><a href="BranchMaintenancePage.aspx"><span>Branches</span></a></li>
                        <li><a href="AuditTrailPage.aspx"><span>Audit Trail</span></a></li>
                    </ul>
                </li>
            </ul>
        </div>

Here's the CSS for the Menu:

/* menu */

#templatemo_menu
{
    clear: both;
    width: 100%;
    height: 30px; /*padding: 0 10px;*/ /*margin-bottom: 20px;*/ /*margin-left:13px;*/
    background: url(../Images/bgContent.jpg) center no-repeat;
}

#templatemo_menu ul
{
    margin: 0 auto;
    text-align: center;
    width: 100%;
    display: inline-block;
    height: 70px;
    margin: 0;
    padding: 1px 0;
    list-style: none;
}

#templatemo_menu ul li
{
    padding: 0 0 0 0;
    margin: 0;
    display: inline-block;
}

#templatemo_menu ul li a
{
    float: left;
    display: block;
    height: 22px;
    width: 440px;
    padding: 5px 0 0 0;
    font-size: 11px;
    color: #666;
    text-align: center;
    text-decoration: none;
    font-weight: normal;
    outline: none;
    border: none;
    background: url(../Images/templatemo_menu_divider.gif) repeat-y right;
}

#templatemo_menu ul li a span
{
    display: block;
    font-size: 17px;
    font-weight: normal;
    color: #ffffff;
}

#templatemo_menu ul li .last
{
    background: none;
}


#templatemo_menu ul li a:hover, #templatemo_menu ul .current
{
    color: #a13c03;
}

#templatemo_menu ul li a:hover span, #templatemo_menu ul .current span
{
    color: #a13c03;
}

#templatemo_menu ul li a span:hover
{
    color: #a13c03;
}

#templatemo_menu ul li:hover
{
    background: #0298D7;
}

#templatemo_menu li:hover ul
{
    display: block;
    background: #0A5185;
    height: auto;
    width: 440px;
    margin-top: 25px;
    z-index: 2;
}

#templatemo_menu li ul
{
    display: none;
    position: absolute;
}

#templatemo_menu li ul li
{
    clear: both;
    border-style: none;
}

#templatemo_menu li ul li:hover
{
    background-color: #0298D7;
}

I've tried adding a.MyLink:link{do css here}, but it doesn't seem to be working. Any suggestions or help would be greatly appreciated! :(

Answer №1

Update your link button code with this change

<asp:LinkButton ID="MyNewLink" runat="server"><span>Double Entry Per Total Expired</span></asp:LinkButton>

The CSS is specifically targeting the span inside the anchor, so make sure to include the span tag around the text just like you did for the other anchor elements.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Different option for animated side slider based on location

Whenever I click on this div, it slides out smoothly. Check out these images to get a visual of what I am aiming for: This is how the Div looks when collapsed by default https://i.stack.imgur.com/zJIsA.png Once slid out, the Div looks like this (highlig ...

Troubleshooting a dysfunctional collapsed navbar in React with Bootstrap 5

I am experiencing an issue where the collapsed navbar icon does not expand when clicked on smaller screens. I followed the example provided by bootstrap 5 and made sure to include bootstrap css/js and jquery. class CustomNavBar extends Component { re ...

Show images aligned in the center with proper positioning

img { vertical-align: middle; } .right { ??? } <img align='right' class='right' src='images/online_icon.png' border="0" width=8/> I am trying to position images on the right side while keeping them vertically aligned ...

When hovering over one item, it causes a hover effect on an item in a SEPARATE container

My goal is to create a unique interaction between links and images, where hovering over a link will transform the corresponding image below it, and vice versa. I have been searching for solutions but have only found methods that work when all items are wit ...

What is the best method for converting Unix time to a readable date

<el-table-column label="Time Created" prop="create_time"></el-table-column> https://i.stack.imgur.com/aoLjf.png The timestamp data from the backend is in milliseconds format (e.g. 1527150668419) and is stored as create_time property in this.i ...

"Maximizing Space: A Guide to Setting BootStrap Navbar on the Right Side of the Page with Dropdown Width

Take a look at the image below. There is a navbar toggle button on the upper right corner of the page. When I expand it, the dropdown items occupy the entire width of the page, causing an issue where clicking anywhere within the red box triggers the dropdo ...

The navigation bar vanishes from sight while scrolling underneath other sections

UPDATE: Problem solved! I discovered that the 'overflow:hidden' inside the #main for the media query was causing the navigation to disappear. I have a scroll navigation positioned at the top of my webpage. However, as I scroll down, the navigati ...

The tooltip is obscured by the table row

I'm having trouble with a simple CSS fix and can't seem to figure out why. The z-index and overflow visibility properties are not working as expected. I just need 'In Progress' to be displayed above everything else. Some things I' ...

Can you please explain the purpose of the white space in the HTML code?

Currently, I am working on developing a mobile application, and as I start adding styles, I notice a mysterious blank space that seems to be appearing out of nowhere. Can anyone provide any insights or suggestions to help me troubleshoot this issue? https ...

div or paragraph element nested within a flex container

How can I make the logo text div tag, called Title, take up its content space inside the parent flexbox without wrapping? I prefer not to set the Title div to 100% or use white-space: nowrap. I simply want it to behave like a regular div where it fills it ...

How can we use the nth-of-type selector to target a set of eight elements in a

I am trying to style a group of divs in such a way that every set of eight elements will have the same left positioning. Rather than just styling every eighth element individually, I want to apply the styling to groups of eight elements at once. However, ...

Styling targeted to a particular div

Currently, I am attempting to showcase a docx file on my webpage by converting it to HTML and then displaying it. However, this method generates CSS with rules that end up impacting the entire document. For instance, it changes all links to blue which co ...

Add at the beginning of each row in the text area

I have a small text area on my webpage where I want to add ">>" to the beginning of each line. My initial attempt was to use this code: $("#mytextarea").prepend("EvilHacker001>>"); Unfortunately, this did not produce the desired result. I se ...

Proper Sequence of Bootstrap Header Configuration

I'm working on creating a header/navbar using bootstrap, but I'm unsure about the correct order and method to achieve this. This is how I want it to look: And when collapsed: Should everything be contained within the NAV tag? I have a header ...

Ways to alter the color of an icon when hovering over it

Is there a way to change the color of a material icon inside an IconButton material component when hovering over the IconButton? I've tried adding a class directly to the icon, but it only works when hovering over the icon itself and not the IconButto ...

Avoiding the use of a particular URL when using this.router.navigate() in AngularJs

In my angularJS registration form, I am using a bootstrap template for the design. The URL path to access the form page is http://localhost:4200/signup <form method="post" (submit)='register(username.value,email.value,password.value)'> ...

Tips for customizing the default styles of PrimeNG's <p-accordion> tag

Hello, I have encountered an issue with my html code snippet. I am attempting to create a tab with a label-header named "Users", but the accordion tag consistently displays it as underlined. <div class="ui-g"> <p-accordion id="tabsHeader"> ...

An issue occurred while the request was being transported or processed, resulting in Error code 10 at Path /wardeninit

Currently, I am attempting to pass an object (specifically the contents of a row from a sheet) to an apps script template. The screenshot displays the actual row. https://i.stack.imgur.com/IzMrn.png The function in my apps script consists of the followin ...

The surprising margins that Bootstrap sneaks into columns

It seems like bootstrap is mysteriously including an unseen margin in my column classes. Even after inspecting an element labeled as 'col-lg-3,' there is no visible margin CSS, and attempting to manually add margin:0 still results in a margin bei ...

Utilizing a percentage for the border-width property

I want to remove a triangle from the bottom of a div using a CSS trick involving borders. This involves creating a border with one transparent side and coloring the other sides to create the triangle effect. The issue I'm facing is that the div has a ...