Challenges with HTML Formatting

Currently, I am working on designing a master page for a website and running into a bit of trouble with a CSS3 dropdown menu in a .NET Web App. The specific issue I'm facing is related to the nav element not displaying a background color as intended. Although I have successfully implemented similar dropdown menus before without any problems, this project seems to be presenting some unexpected challenges.

Here's the markup code:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="MirandasWebsite.SiteMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link href="Styles/Mir3.css" rel="stylesheet" type="text/css" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type='text/javascript'></script>
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
    <title></title>
</head>
<body runat="server">
    <form id="form1" runat="server" method="post">
    <div class="wrap">
        <nav>
                <ul class="menu">
                <div id="HomePage" class="zoom" runat="server"><li class="menuitem"><a href="Default.aspx" id="aDefault" runat="server">Home</a></li></div>
                <li class="menuitem"><a id="aMedia" href="#" runat="server">Media</a>
                    <ul>
                                    <div id="Photos" class="zoom" runat="server"><li class="menuitem"><a href="#" id="aPhotos" runat="server">Photos</a></li></div>
                                    <asp:HiddenField ID="hfPhotos" runat="server" Value="#" />
                                    <div id="Videos" class="zoom" runat="server"><li class="menuitem"><a href="#" id="aVideos" runat="server">Videos</a></li></div>
                                    <asp:HiddenField ID="hfVideos" runat="server" Value="#" />
                                    <div id="Audio" class="zoom" runat="server"><li class="menuitem"><a href="#" id="aAudio" runat="server">Audio</a></li></div>
                                    <asp:HiddenField ID="hfAudio" runat="server" Value="#" />
                   </ul>
                </li>
                <li class="menuitem"><a id="a1" href="#" runat="server">About Me</a>
                    <ul>
                                    <div id="Biography" class="zoom" runat="server"><li class="menuitem"><a href="#" id="aBiography" runat="server">Biography</a></li></div>
                                    <asp:HiddenField ID="hfBiography" runat="server" Value="#" />
                                    <div id="Resume" class="zoom" runat="server"><li class="menuitem"><a href="#" id="aResume" runat="server">Resume</a></li></div>
                                    <asp:HiddenField ID="hfResume" runat="server" Value="#" />
                    </ul>
                </li>
                <div id="ContactMe" class="zoom" runat="server"><li class="menuitem"><a id="a2" href="#" runat="server">Contact Me</a></li></div>
                </ul>
                <div class="clearfix"></div>
            </nav>
    </div>
<div class="Contents">
    <asp:ContentPlaceHolder ID="MainContent" runat="server">
    </asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

The CSS used:

/*------------Main Styles------------*/
html
{
    height: 100%;
    width: 100%;
}

body
{
    position: relative;
    min-height: 100%;
    min-width: 100%;
    height: 100%;
    width: 100%;
    background: -webkit-radial-gradient(center, circle farthest-corner, #680000 0%, Black 100%);
    background: -moz-radial-gradient(center, circle farthest-corner, #680000 0%, Black 95%);
    background: -ms-radial-gradient(center, circle farthest-corner, #680000 0%, Black 95%);
    background: -o-linear-gradient(top, #680000, Black);
}

ul
{
    list-style: none;
}

/*------------Drop Down Menu------------*/

.wrap
{
    max-width: 100%;
    margin: 4em auto;
}

nav
{
    background: -webkit-gradient(linear, center top, center bottom, from(#cccccc), to(#999999));
    background: -moz-radial-gradient(center, circle farthest-corner, #cccccc 0%, #999999 95%);
    background: -ms-radial-gradient(center, circle farthest-corner, #cccccc 0%, #999999 95%);
    background: -o-linear-gradient(top, #cccccc, #999999);   
    position: relative;
    text-align: center;
}

.menu
{
    text-align: center;
    margin: auto%;
    background-color: Silver;
}

...
<!-- Rest of the CSS code omitted for brevity -->
...

Your assistance will be greatly appreciated.

Answer №1

The navigation bar is unable to calculate its width because none of the elements inside it have a specified width, which is why it cannot display any background.

Answer №2

Simply assign the height attribute to your navigation element:

CSS

nav
{
    background: -webkit-gradient(linear, center top, center bottom, from(#cccccc), to(#999999));
    background:  -moz-radial-gradient(center, circle farthest-corner, #cccccc 0%,  #999999 95%);
    background: -ms-radial-gradient(center, circle farthest-corner, #cccccc 0%, #999999 95%); /* For IE10 */
    background: -o-linear-gradient(top, #cccccc, #999999); /* For Opera */
    position: relative;
    text-align: center;
    height:30px;
}

SEE DEMO

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

Practical applications of flexible layouts in everyday life

I'm currently on the hunt for real-world examples of elastic layouts, specifically those based on using em's for widths. Surprisingly, I haven't been able to find much out there. If anyone knows of any examples, I would greatly appreciate it ...

Modify the appearance of selectInput and numericInput controls

Looking to update the appearance of my Shiny UI elements to better match the overall website design. Specifically, I want to eliminate the rounded edges on the selectInput boxes for a cleaner look like this: https://i.sstatic.net/pepak.png Additionally, ...

What is the best way to implement a side navigation bar with 100 tabs using Angular 4?

I am new to learning AngularJS and could use some guidance. Currently, I am working on an Angular 4 SPA project that consists of a sidebar with 100 tabs, each containing different content. Here is an image of the sidebar. I have tried a simple approach by ...

Struggling to make the jQuery timepicker plugin work on my JSP page

Hi everyone, I'm having trouble getting a jQuery plugin called timepicker to work. I already have a datepicker setup and running smoothly. I've spent hours researching this issue and trying different plugins. Here's my process: I download th ...

How to stop Bootstrap collapsible items from "shifting"

I recently integrated a Bootstrap collapse plugin to manage my list of common inquiries: https://jsfiddle.net/2d8ytuq0/ <ul class="faq__questions"> <li> <a href="#" data-toggle="collapse" data-target="#faq__question_1">..</a> ...

Preserving data and retrieving it

I've been working on a program for my diving coach that calculates the dive score as judges input their judgments. However, I'm encountering an issue where all fields clear themselves when I hit submit. Moreover, I'd like the ability to save ...

Can you recommend a resource that provides a comprehensive breakdown of which CSS elements are compatible with each internet

Can anyone recommend a comprehensive resource, such as a book or website, that provides a complete list of CSS elements and their compatibility with the major web browsers? Specifically, I am interested in information regarding compatibility with IE8 and F ...

Mastering image focus with javascript: A comprehensive guide

On my HTML page, I have two images and a textbox. I want the focus to shift between the images based on the first character entered in the textbox. For example, when the user types '3', the first image should be focused, and for '4', th ...

Ways to expand the play and pause buttons and adjust the height of an HTML audio player

It's clear that the PLAY/PAUSE icons are smaller than intended, and the entire player is thinner than desired, making it difficult for some viewers to see. How can I enlarge the entire player? I have read that we do not have access to individual contr ...

PHP HTML Three-Dots Menu

I am currently working on a social networking site where I am trying to add three menu dots in the top right corner of each post made by a user. However, I am facing an issue where the dropdown menu only appears for the very first post at the top of the pa ...

Is there a way to achieve the desired outcome without relying on Bootstrap?

I stumbled upon a code snippet in an online article which showcased a live demo accessible through this link Upon further investigation, I managed to craft a simple modal using just a few lines of jquery and CSS without relying on bootstrap. For instance ...

"Looking to add some auditory flair to your web page with a sound on Image-Click in HTML

Is there a way to make a sound play when I click or hover over my play button? Here's what I've managed to do so far. I have a button that changes the image when hovered over, but I also want it to trigger an MP3 audio file. play a { positio ...

What is the best way to execute two JavaScript functions within an inline onclick event?

I am currently working on the following code snippet: <script> function delay (URL) { setTimeout( function() { window.location = URL }, 2000); }</script> And then I have the following within the <body> element: <img src="small_rabbi ...

Combining unique values from a single column and calculating the sum from the remaining columns in ASP.NET platform

I've got a table set up like this: +------+------+------+------+------+ | ID | Name |Parm1 |Parm2 |Parm3 | +------+------+------+------+------+ | 1 |Type1 | 1 | 2 | 3 | +------+------+------+------+------+ | 2 |Type2 | 2 | 3 | ...

Utilizing JQuery AJAX and PHP for Data Encoding

My webpage is encoded in HTML with the charset ISO-8859-2. All content on the page adheres to this charset and appears correctly. However, I am facing an issue when making an Ajax call to a PHP server. When I send the character á and receive the same valu ...

Stop dropdown from closing upon clicking menu items

I have been experimenting with Bootstrap 4 alpha6 and have encountered an issue with my dropdown menu. Here is the HTML code for my dropdown: <div class="dropdown"> <button class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" type= ...

The specified @Parameter1 cannot be used as a parameter in this procedure

MODIFY PROCEDURE [dbo].[NST_InsertTblGenLedDet] @GHDHeader int, @Gldtype text, @GldAccount text, @GldDate DateTime, @GldVoucherType int, @GldDebit float=null, @GldCredit float= null, @GldDtaLine int= nul ...

Tips for implementing URL rewriting for [mywebsitename].com/pages/224?task=5 using asp.net

After successfully implementing URL rewriting for [mywebsitename].com?type=pages&id=22 to [mywebsitename].com/pages/224, the question arises:</p> <p>Is it possible to utilize </p> <pre><code>[mywebsitename].com/page ...

Achieving consistent radiobutton width across various column widths

Struggling to match the size of the radio button area (input-group-addon) in col-sm-4 and col-sm-6 columns? Considering using min-width to achieve a consistent width but finding no success? Seeking uniform width for radio button controls? Check out this vi ...

CSS Overflow Properties - Emulate the Input of a Lengthy Equation in a Calculator

Creating a calculator project with the challenge of handling long mathematical equations that exceed the display width. The goal is to have the left side of the equation scroll off the screen when it becomes too lengthy. For instance: 50+200x25/43-500x60 ...