Results 1 to 10 of 10

Thread: Chrome CSS Drop Down Menu

  1. #1
    Join Date
    Jun 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Chrome CSS Drop Down Menu

    I'm using "Chrome CSS Drop Down Menu" on my site:
    http://nonameclan.pl/

    I would like to set permanent width of menu buttons regardless of the number of characters. With that my Menu will have 100% width and it will fit better to my site.
    Now as you can see last button "CONTACT" is to short and I can't fix it by changing padding value.

    Thank you for your help.

  2. #2
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by aduh View Post
    I'm using "Chrome CSS Drop Down Menu" on my site:
    http://nonameclan.pl/

    I would like to set permanent width of menu buttons regardless of the number of characters. With that my Menu will have 100% width and it will fit better to my site.
    Now as you can see last button "CONTACT" is to short and I can't fix it by changing padding value.

    Thank you for your help.
    Hiya aduh, could you please post the specific coded for the nab bar?
    Bernie

  3. #3
    Join Date
    Jun 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Code:
    .chromestyle{
    width:100%;
    font-weight: bold ;
    font:10px Verdana;
    }
    
    .chromestyle:after{ /*Add margin between menu and rest of content in Firefox*/
    content: "."; 
    display: block; 
    height: 0; 
    clear: both; 
    visibility: hidden;
    }
    
    .chromestyle ul{
    
    width: 100%;
    background: url(chromebg4.gif) center center repeat-x; /*THEME CHANGE HERE*/
    padding: 12px 0;
    margin: 0;
    text-align: left; /*set value to "left", "center", or "right"*/
    }
    
    .chromestyle ul li{
    display: inline;
    }
    
    .chromestyle ul li a{
    color: #FFFFFF;
    padding: 12px 26px;
    margin: 0;
    text-decoration: none;
    border-right: 1px solid #1c1c1a; /*THEME CHANGE HERE*/
    }
    
    .chromestyle ul li a:hover, .chromestyle ul li a.selected{ /*script dynamically adds a class of "selected" to the current active menu item*/
    background: url(chromebg4-over.gif) center center repeat-x; /*THEME CHANGE HERE*/
    }
    
    
    /* ######### Style for Drop Down Menu ######### */
    
    .dropmenudiv{
    position:absolute;
    top: 0;
    border: 1px solid #be0c00; /*THEME CHANGE HERE*/
    border-bottom-width: 0;
    font:normal 10px Verdana;
    line-height:18px;
    z-index:100;
    background-color: white;
    width: 175px;
    visibility: hidden;
    filter:alpha(opacity=92);
    opacity: 0.92;
    -moz-opacity:0.92;
    }
    
    
    .dropmenudiv a{
    width: 100%;
    display: block;
    text-indent: 3px;
    border: 1px solid #FFFFFF; /*THEME CHANGE HERE*/
    padding: 3px 0;
    text-decoration: none;
    font-weight: bold;
    color: #242424;
    filter:alpha(opacity=92);
    opacity: 0.92;
    -moz-opacity:0.92;
    }
    
    .dropmenudiv a:hover{ /*THEME CHANGE HERE*/
    background-color: #292929;
    color: #ffffff;
    filter:alpha(opacity=92);
    opacity: 0.92;
    -moz-opacity:0.92;
    }
    Last edited by aduh; 06-24-2012 at 09:01 AM.

  4. #4
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Thanks aduh,
    As a side note, please encase your code in [CODE] tags when posting it on the forum.
    Now in:
    Code:
    .chromestyle ul li{
    display: inline;
    }
    Try setting width as a number of pixels. For example:
    Code:
    .chromestyle ul li{
    display: inline;
    width: 100px;
    }
    This will set the width of each li as a fixed amount that will not change.
    In order to change the width of "contact" individually, you could set that particular li an id and then in the CSS specify the width for that id.
    Bernie

  5. #5
    Join Date
    Jun 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by bernie1227 View Post
    Try setting width as a number of pixels. For example:
    Code:
    .chromestyle ul li{
    display: inline;
    width: 100px;
    }
    Thanks bernie1227 but it didnt works.
    Can't see any different ...

  6. #6
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by aduh View Post
    Thanks bernie1227 but it didnt works.
    Can't see any different ...
    I think that there may be a conflicting CSS rule in the class:
    Dropmenudiv

    Bernie

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The width is set hard coded in the page's HTML. For the contact drop down, that's here:

    Code:
    <!--3rd drop down menu -->                                                   
    <div id="dropmenu3" class="dropmenudiv" style="width: 150px;">
    <a href="index.php?site=contact">WYŚLIJ EMAIL</a>
    <a href="index.php?site=joinus">DOŁĄCZ DO NAS</a>
    <a href="index.php?site=challenge">RZUĆ WYZWANIE</a>
    <a href="index.php?site=guestbook">KSIĘGA GOŚCI</a>
    </div>
    I think about 116px would look good there.

    Or you can use overriding style in the stylesheet for that one drop down:

    Code:
    .dropmenudiv#dropmenu3 {
    	width: 116px !important;
    }
    Other drop downs may be set similarly. Or if you want them all the same, don't set any in the HTML and use the stylesheet here:

    Code:
    .dropmenudiv{
    position:absolute;
    top: 0;
    border: 1px solid #be0c00; /*THEME CHANGE HERE*/
    border-bottom-width: 0;
    font:normal 10px Verdana;
    line-height:18px;
    z-index:100;
    background-color: white;
    width: 175px;
    visibility: hidden;
    filter:alpha(opacity=92);
    opacity: 0.92;
    -moz-opacity:0.92;
    }
    The browser cache may need to be cleared and/or the page refreshed to see changes.
    Last edited by jscheuer1; 06-24-2012 at 02:47 PM. Reason: saw where width is set
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Jun 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    jscheuer1 it's not about dropdown menu width
    it's about menu buttons width
    As you can see hole menu didnt fit 100% with the site.
    Last button (KONTAKT) is to short.
    I would like to set same widht for all buttons like on this page:
    http://nonameclan.pl/2

    ... or set specify widh for last button (KONTAKT) to fit 100% to the site width

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, the padding is set for all here:

    Code:
    .chromestyle ul li a{
    color: #FFFFFF;
    padding: 12px 26px;
    margin: 0;
    text-decoration: none;
    border-right: 1px solid #1c1c1a; /*THEME CHANGE HERE*/
    }
    But if you increase the left/right padding (26px), the overall addition is too great and the menu wraps.

    Again we can go inline to the element:

    Code:
    <div class="chromestyle" id="chromemenu" >
    <ul>
    <li><a href="index.php?site=news">HOME</a></li>
    <li><a href="index.php?site=calendar">KALENDARZ</a></li>
    <li><a href="index.php?site=files">POBIERANIE</a></li>
    <li><a href="#" rel="dropmenu2">KLAN</a></li>
    <li><a href="#" rel="dropmenu1">FORUM</a></li>
    <li><a href="index.php?site=links">LINKI</a></li>
    <li><a href="index.php?site=server">SERWERY</a></li>
    <li><a href="index.php?site=videos">WIDEO</a></li>
    <li><a href="#" style="padding: 12px 28px;" rel="dropmenu3">KONTAKT</a></li>
    </ul>
    </div>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Jun 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    jscheuer1 almost perfect but as you can see
    now the red button "chromebg4-over.gif" from "KONTAKT" button is to short
    Code:
    <li><a href="#" style="padding: 12px 28px;" rel="dropmenu3">KONTAKT</a></li>
    when I set: padding: 12px 27px; button is little bit to short ...
    any ideas ?

    full code:
    Code:
    <div class="chromestyle" id="chromemenu" >
    <ul>
    <li><a href="index.php?site=news">HOME</a></li>
    <li><a href="index.php?site=calendar">KALENDARZ</a></li>
    <li><a href="index.php?site=files">POBIERANIE</a></li>
    <li><a href="#" rel="dropmenu2" style="padding: 12px 29px;">KLAN</a></li>
    <li><a href="#" rel="dropmenu1">FORUM</a></li>
    <li><a href="index.php?site=links" style="padding: 12px 27px;">LINKI</a></li>
    <li><a href="index.php?site=server">SERWERY</a></li>
    <li><a href="index.php?site=videos" >WIDEO</a></li>
    <li><a href="#" style="padding: 12px 28px;" rel="dropmenu3">KONTAKT</a></li>
    </ul>
    </div>
    
    <!--1st drop down menu -->                                                   
    <div id="dropmenu1" class="dropmenudiv" style="width: 150px;">
    <a href="index.php?site=forum">NO NAME CLAN</a>
    <a href="http://nonameclan.pl/forum/" target="_blank">2012 APOCALYPSE NNC</a>
    </div>
    
    
    <!--2nd drop down menu -->                                                
    <div id="dropmenu2" class="dropmenudiv" style="width: 150px;">
    <a href="index.php?site=squads">DRUĹYNY</a>
    <a href="index.php?site=clanwars">KLANÓWKI</a>
    <a href="index.php?site=members">SKĹAD</a>
    <a href="index.php?site=history">HISTORIA</a>
    <a href="index.php?site=awards">NAGRODY</a>
    </div>
    
    <!--3rd drop down menu -->                                                   
    <div id="dropmenu3" class="dropmenudiv" style="width: 124px;">
    <a href="index.php?site=contact">WYĹšLIJ EMAIL</a>
    <a href="index.php?site=joinus">DOńCZ DO NAS</a>
    <a href="index.php?site=challenge">RZU† WYZWANIE</a>
    <a href="index.php?site=guestbook">KSI˜GA GOĹšCI</a>
    </div>
    EDIT
    when I have add code:
    Code:
    <div class="chromestyle" id="chromemenu" style="width: 1001px;" >
    then menu is 1px to wide but button KONTAKT is fine :-)
    Last edited by aduh; 06-24-2012 at 09:51 PM.

Bookmarks

Posting Permissions

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