Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member djsquid's Avatar
    Join Date
    Aug 2011
    Location
    Staffordshire
    Posts
    15
    Member #
    28854
    Hey,

    I'm new to web design but currently working on a little project. I have created the foundation to my navigation menu which What I want to achieve is have a menu within the main navigation menu, so a sub menu. My question been can I style this sub menu separate to the main navigation menu via CSS? and am I right in creating a <ul class> for all the main navigation and a separate <ul class> for the sub menu which will be within one of the items on the main navigation? And then reference these in the CSS? Basically I want to style the sub menu differently to the main navigation menu so if anyone has another way of doing this that would be great to.

    Thanks

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    ids. By using ids, you can style your menu items differently.
    Code:
    ul#main-menu {font-size:  125%;}
    ...
    <ul id="main-menu">
    ...your main menu
    </ul>
    That should give you the idea.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Junior Member djsquid's Avatar
    Join Date
    Aug 2011
    Location
    Staffordshire
    Posts
    15
    Member #
    28854
    Hi, TheGAME 1264

    Thanks for the info

    will this work for the sub menu also?

    so for example;

    <ul id="main-menu">
    <li><a href="#" class="Products">Products</li>
    <ul id="sub-menu1">
    <li><a href="#" class="Cars">Cars</li>
    </ul>
    </ul>

    or would the styling for "main-menu" effect the "cars" as well as the products as this id is within the main-menu id?

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    The styling for main-menu would affect "Cars" to some extent, unless you overrode it like this:

    ul#main-menu li.Cars {css here}

    That would allow you to define CSS styles specifically for Cars.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Junior Member djsquid's Avatar
    Join Date
    Aug 2011
    Location
    Staffordshire
    Posts
    15
    Member #
    28854
    Hey TheHAME1264

    Thanks again for the advice, had a go using the method which you gave me, but unfortunately the styling still effects the other items underneath the sub menu. I must be doing something wrong :unsure:

    If you could get chance to have a quick glimpse at the code, I would really appreciate it, I'm on my third day of trying to get this to work.

    This is my code -

    HTML Code:
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>dreambay</title>
    <link href="dreambay.css" rel="stylesheet" type="text/css" media="screen"/>
    
    </head>
    
    <body>
    
    <div id="main">
        <div class="container">
            <div id="header">
            </div>
                <div id="logo">
                <h1>dreambay</h1>
                </div>
            <ul id="nav">
                <li><a href="#Categories" class="categories">Categories</a></li>
            </ul>
                <ul id="catsub">
                    <li><a href="#" class="fashion">Fashion</a></li>
                    <li><a href="#" class="motors">Motors</a></li>
                    <li><a href="#" class="property">Property</a></li>
                    <li><a href="#" class="services">Services</a></li>
                    <li><a href="#" class="venues">Venues</a></li>
                </ul>
    
            <ul id="nav">
                <li><a href="#Rent" class="rent">Rent</a></li>
                <li><a href="#My dreambay" class="mydreambay">My dreambay</a></li>
                <li><a href="#Support" class="support">Support</a></li>
            </ul>
            <div style="clear:both"></
    
        </div>      <!--end of container-->
    
    </div>            <!--end of main-->
    
      <div id="footer">
        <p>Copyright &copy; 2011 dreambay <br
            All rights reserved</p>
            </div>  <!--end of footer-->
    
    </body>
    </html>

    And this is the CSS -

    @charset "UTF-8";
    /* CSS Document */

    body, div, h1, h2, h3, h4, h5, h6, p, ul, img {margin:0px; padding:0px; }

    body {
    font-family:Arial, Helvetica, sans-serif;
    }

    .container {
    width:852px;
    height:100%;
    margin:0 auto;
    }

    #main {
    background-image:url(dreambay%20images/background.jpg);
    background-repeat:repeat-x;
    width:auto;
    height:1500px;
    }

    #logo {
    background-image:url(dreambay%20images/header.jpg);
    background-repeat:no-repeat;
    height:164px;
    width:1000px;
    }

    #logo h1 {
    text-indent:-9999px;
    }

    /* Navigation Style */

    ul#nav {
    list-style:none;
    width:852px;
    padding-top: 5px;
    }


    /* ------------------------SUB MENU STYLING -----------------------*/

    ul#catsub li {
    list-style:none;
    float:left;
    display:block;
    padding-top:200px;

    }

    /* END OF SUB MENU STYLING */


    ul#nav li .categories {
    text-indent:-9999px;
    display:block;
    font-size: 1px;
    colour: #FFFFFF;
    text-decoration: none;
    float:left;
    padding-left: 1px;
    padding-right: 5px;
    width:128px;
    height:40px;
    background-image:url(menu/categories_static/categories_static.jpg);
    }

    ul#nav li .rent {
    text-indent:-9999px;
    display:block;
    font-size: 1px;
    colour: #FFFFFF;
    text-decoration: none;
    float:left;
    padding-left:1px;
    padding-right:5px;
    width:128px;
    height:40px;
    background-image:url(menu/categories_static/rent_static.jpg);
    }


    ul#nav li .mydreambay {
    text-indent:-9999px;
    display:block;
    font-size: 1px;
    colour: #FFFFFF;
    text-decoration: none;
    float:left;
    padding-left: 1px;
    padding-right: 5px;
    width:154px;
    height:40px;
    background-image:url(menu/categories_static/mydreambay_static.jpg);
    }

    ul#nav li .support {
    text-indent:-9999px;
    display:block;
    font-size: 1px;
    colour: #FFFFFF;
    text-decoration: none;
    float:left;
    padding-left: 1px;
    padding-right: 5px;
    width:106px;
    height:40px;
    background-image:url(menu/categories_static/support_static.jpg);
    }


    ul#nav li .categories:hover {
    text-indent:-9999px;
    display:block;
    font-size: 1px;
    colour: #FFFFFF;
    text-decoration: none;
    float:left;
    padding-left: 1px;
    padding-right: 5px;
    width:128px;
    height:40px;
    background-image:url(menu/categories_hover/categories_hover.jpg);
    }

    ul#nav li .rent:hover {
    text-indent:-9999px;
    display:block;
    font-size: 1px;
    colour: #FFFFFF;
    text-decoration: none;
    float:left;
    padding-left: 1px;
    padding-right: 5px;
    width:128px;
    height:40px;
    background-image:url(menu/categories_hover/rent_hover.jpg);
    }

    ul#nav li .mydreambay:hover {
    text-indent:-9999px;
    display:block;
    font-size: 1px;
    colour: #FFFFFF;
    text-decoration: none;
    float:left;
    padding-left: 1px;
    padding-right: 5px;
    width:154px;
    height:40px;
    background-image:url(menu/categories_hover/mydreambay_hover.jpg);
    }

    ul#nav li .support:hover {
    text-indent:-9999px;
    display:block;
    font-size: 1px;
    colour: #FFFFFF;
    text-decoration: none;
    float:left;
    padding-left: 1px;
    padding-right: 5px;
    width:106px;
    height:40px;
    background-image:url(menu/categories_hover/support_hover.jpg);
    }

    /* END OF NAVIGATION STYLE */

    #footer p {
    position:absolute;
    bottom: 0;
    margin-top:3000
    }


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

css individual list items

,

css li individual

,

css style individual list items

,

style individual list items css

Click on a term to search for related topics.
All times are GMT -6. The time now is 10:27 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com