Results 1 to 7 of 7

Thread: How to create horizontal menu using CSS

  1. #1
    Join Date
    Feb 2010
    Posts
    188

    How to create horizontal menu using CSS

    Hi all,

    I am a web developer and build a adds company website. My site have different menu and making the menu has been mentioned in CSS method, but many time it is not clear how to achieve, and the realization of principle, I need some help from you for detailed tutorial. Please help. Thanks in advance.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to create horizontal menu using CSS

    The first step is the establishment of an unordered list.We first establish an unordered list to build the menu structure. The Code is:
    Code:
    <ul>
    <li> <a href="1"> Home </ a> </ li>
    <li> <a href="2"> Products </ a> </ li>
    <li> <a href="3"> Services </ a> </ li>
    <li> <a href="4"> technical support </ a> </ li>
    <li> <a href="5"> purchase </ a> </ li>
    <li> <a href="6"> Contact us </ a> </ li>
    </ ul>
    Check the code and reply.


      

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    How to create horizontal menu using CSS

    You can put hidden li default style, Because it does not look very good looking, the menu usually do not need the default dot li, we have to define a style UL to eliminate these dots. Of course, in order to better control the entire menu, we placed a div inside the menu. Page code becomes:<div
    Code:
    class="test"> <ul>
    <li> <a href="1"> Home </ a> </ li>
    <li> <a href="2"> Products </ a> </ li>
    <li> <a href="3"> Services </ a> </ li>
    <li> <a href="4"> technical support </ a> </ li>
    <li> <a href="5"> purchase </ a> </ li>
    <li> <a href="6"> Contact us </ a> </ li>
    </ ul> </ div>
    CSS is defined as:. test ul (list-style: none. Note that ". Test ul" to express my style would be to define the role of the test layer inside the ul tag.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    How to create horizontal menu using CSS

    If you need to the key to the floating. Here is the menu into a horizontal key, and we add to the li element of a "float: left;" attribute, so that each li a li floating in front of the left side.CSS is defined as: . test li (float: left; ). We have to adjust the width of the li. Add in the CSS defined width: 100px specify the width of a li is 100px, of course, you may need to adjust according to your values:. Test li (float: left; width: 100px; ). Check and reply.

  5. #5
    Join Date
    Jan 2008
    Posts
    1,521

    How to create horizontal menu using CSS

    we set the link through the CSS styles are defined: link,: visited,: hover state. test a: link (color: # 666; background: # CCC; text-decoration: none; )
    Code:
    . test a: visited (color: # 666; text-decoration: underline;)
    Code:
    . test a: hover (color: # FFF; font-weight: bold; text-decoration: underline; background: # F00;)
    A friend asked why the background color of the menu links do not fill the entire width of li Well, the solution is very simple to add the definition of a style of display: block, block-level element so that links to display. We also fine-tune the following details:
    # Use text-align: center will center the menu text;
    # With height: 30px add to the background of the height;
    # With the margin-left: 3px so that each menu, the distance between the air 3px;
    # With the line-height: 30px; the definition of the row height, so that the link text vertically centered;
    # CSS definition like this:. test a (display: block; text-align: center; height: 30px; ) . test li (float: left; width: 100px; background: # CCC; margin-left: 3px; line-height: 30px; )
    All the best.

  6. #6
    Join Date
    Nov 2005
    Posts
    1,323

    How to create horizontal menu using CSS

    We will normally at the front of each link a small icon, so that navigation clearer. CSS is used the definition of li background image to achieve this:. test a: link (color: # 666; background: url (arrow_off.gif) # CCC no-repeat 5px 12px; text-decoration: none
    Code:
    . test a: hover (color: # FFF; font-weight: bold; text-decoration: none; background: url (arrow_on.gif) # F00 no-repeat 5px 12px;)
    "background: url (arrow_off.gif) # CCC no-repeat 5px 12px;" sentence CSS code is an acronym that background image is arrow_off.gif; the background color is # CCC; background image not repeat the "no-repeat "background image position from the left 5px, top margin 12px; By default, the icon for the arrow.off.gif, when the mouse move to the link. Best of luck.

  7. #7
    swapantech1 Guest

    Re: How to create horizontal menu using CSS

    Dear all,

    With due respect, these are paramount of importance.

    roy

Similar Threads

  1. How to create Menu using ASP?
    By Solitario in forum Software Development
    Replies: 4
    Last Post: 05-02-2010, 03:44 AM
  2. How to use AVS Video ReMaker to create DVD menu
    By Aadeshh in forum Windows Software
    Replies: 5
    Last Post: 30-01-2010, 02:47 AM
  3. How to create drop down menu in php
    By Sukhvinder in forum Software Development
    Replies: 3
    Last Post: 06-08-2009, 11:42 AM
  4. How to create Menu Bar in JavaFX
    By T0tal L0$$ in forum Software Development
    Replies: 3
    Last Post: 29-07-2009, 03:28 PM
  5. How do I create Menu at runtime in VB?
    By Chandrakant81 in forum Software Development
    Replies: 5
    Last Post: 27-02-2009, 05:32 PM

Tags for this Thread

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
  •  
Page generated in 1,750,439,179.93604 seconds with 16 queries