Hello,

I am trying to create a dropdown menu just like this site: Doxadigital

Any free script to do so ?

Thanks before.

Dani AI

Generated

Quick diagnosis: the dropdown is picking up the same appearance because your hover rule and selector scope are too broad, and the markup looks mis-nested. 's tutorial suggestion is useful for patterns, and was right to push for real text instead of image slices — that makes styling and accessibility far easier. Two fixes: 1) make sure each submenu ul is nested inside its parent li (valid HTML), and 2) target only the top-level anchors with the child selector so submenu anchors get their own styles.

Example structure and targeted CSS (minimal, not a copy of your posted code):

<ul id="nav">
  <li><a href="#">Home</a></li>
  <li>
    <a href="#">Portfolio</a>
    <ul class="dd">
      <li><a href="#">Web</a></li>
      <li><a href="#">Marketing</a></li>
    </ul>
  </li>
  <li><a href="#">Contact</a></li>
</ul>
/* main (top-level) only */
#nav > li > a { display:block; padding:10px 18px; background:#c1c1bf; }

/* hover should affect only top-level items */
#nav > li:hover > a { background:#8f8f8f; color:#fff; }

/* show the submenu on hover and style dropdown items separately */
#nav ul { display:none; position:absolute; top:100%; left:0; }
#nav > li:hover > ul { display:block; }
#nav ul li a { background:#f6f6f6; color:#222; padding:8px 12px; }
#nav ul li:hover > a { background:#e6e6e6; }

To get a single rounded end on the whole bar, target the last top-level link:

#nav > li:last-child > a { border-top-right-radius:12px; border-bottom-right-radius:12px; }

Extra tips: validate the HTML structure (nested ul inside the parent li), use browser DevTools to inspect computed styles and specificity, prefer CSS backgrounds/gradients/box-shadow and pseudo-elements for decorative circles (no JPGs), and add keyboard support (focus states or :focus-within) for accessibility. These steps will separate the dropdown’s look from the main bar cleanly while keeping the nav flexible and image-free.

Recommended Answers

All 5 Replies

What about this:

Thanks. Now, cek this site again:

Click on the portfolio menu. I wonder why the background for the drop down menu is similar like the main menu. How to distinguish them?

This is the codes:

index.php

<ul id="navlist">
<li id="about"><a href="index.php"></a></li>
    <ul id="nav">
        <li><a class="fly" href="#"></a>
            <ul class="dd">
                <li><a href="portfolio.php">Web Porfolio</a></li>
                <li><a href="marketing-portfolio.php">Marketing Portfolio</a></li>             
            </ul>
        </li>     
    </ul>
<li id="services"><a href="services.php"></a></li>
<li id="blog"><a href="blog.php"></a></li>
<li id="contact"><a href="contact.php"></a></li>
</ul>

style.css

/* navigation pop up */

/* main menu styles */
/*
#nav,#nav ul {
    background-image:url(./images/tr75.png);
    list-style:none;
    margin:0;
    padding:0;
}
*/
#nav {
    height:41px;
    padding-left:5px;
    padding-top:5px;
    position:relative;
    z-index:2;
}
#nav ul {
    left:-9999px;
    position:absolute;
    top:37px;
    width:auto;
}

#nav ul ul {
    left:-9999px;
    position:absolute;
    top:0;
    width:auto;
}

#nav li {
    float:left;
    margin-right:5px;
    position:relative;
}
#nav li a {
    margin: -5px 0 0 140px;
    background:#c1c1bf;
    color:#000;
    display:block;
    float:left;
    font-size:16px;
    padding:0px;
    text-decoration:none;
}
#nav > li > a {
    -moz-border-radius:0px;
    -webkit-border-radius:0px;
    -o-border-radius:0px;
    border-radius:0px;

    overflow:hidden;
}
#nav li a.fly {
    background:url('images/navbar.jpg') -150px 0;
}
#nav ul li {
    margin:0;
}
#nav ul li a {
    width:120px;
}
#nav ul li a.fly {
    padding-right:10px;
}

/*hover styles*/
#nav li:hover > a {
    background: url('images/navbar.jpg') -150px -40px;
    color:#fff;
}

/*focus styles*/
    #nav li a:focus {
    outline-width:0;
}

/*popups*/
#nav li a:active + ul.dd,#nav li a:focus + ul.dd,#nav li ul.dd:hover {
    left:0;
}
#nav ul.dd li a:active + ul,#nav ul.dd li a:focus + ul,#nav ul.dd li ul:hover {
    left:140px;
}

/* navigation pop up end */

Thanks before.

Your hover style is going into effect (Lines 69 - 73).

I'd replace the images with text, for real text and style accordingly.

I can code the text, but how to code the background (like the navigation bar) and the box button without jpg file ?

Well, think I can create the navigation bar with round circle at the end and the box button but how to create navigation bar with only one round circle at one end?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.