Beautiful menu in pure css3. css3 dropdown menu


Habr, hello!

A lot appears on Codepen good decisions from different specialists, and I believe that the best of them should be collected in one place. Therefore, 2 years ago I started saving on my computer interesting scripts on various topics.

I used to post them in the mr cloud IDE product group. Gefest, these were assemblies of 5-8 solutions. But now I have started to accumulate 15-30 scripts in different topics (buttons, menus, tooltips, and so on).

Such large sets should be shown to more specialists. That's why I'm posting them on Habr. I hope they will be useful to you.

In this review we will look at multi-level menus.

Flat Horizontal Navigation

Beautiful navigation bar with smoothly appearing submenus. The code is well structured and uses js. Judging by the features used, it works in ie8+.
http://codepen.io/andytran/pen/kmAEy

Material Nav Header w/ Aligned Dropdowns

Adaptive link bar with two-column submenu. Everything is done in css and html. Used css3 selectors that are not supported in ie8.
http://codepen.io/colewaldrip/pen/KpRwgQ

Smooth Accordion Dropdown Menu

Stylish vertical menu with smoothly opening elements. Transition, transform js code is used.
http://codepen.io/fainder/pen/AydHJ

Pure CSS Dark Inline Navigation Menu

Dark vertical navigation bar with icons from ionicons. JavaScript is used. In ie8 it will most likely work without animation.
http://codepen.io/3lv3n_snip3r/pen/XbddOO

Pure CSS3 Mega Dropdown Menu With Animation

Stylish menu with two output formats: horizontal and vertical. Icons and CSS3 animation are used. It will definitely look terrible in ie8, but in other browsers everything is cool.
Vertical link: http://codepen.io/rizky_k_r/full/sqcAn/
Link to horizontal: http://codepen.io/rizky_k_r/pen/xFjqs

CSS3 Dropdown Menu

Horizontal menu with large elements and a drop-down list of links. Clean and minimalistic code without js.
http://codepen.io/ojbravo/pen/tIacg

Simple Pure CSS Dropdown Menu

Simple but stylish horizontal menu. Uses font-awesome. Everything works on css and html, without js. It will work in ie8.
http://codepen.io/Responsive/pen/raNrEW

Bootstrap 3 mega-dropdown menu

An excellent solution for online stores. Displays several levels of categories and large images (for example, a product on sale). It is based on boostrap 3.
http://codepen.io/organizedchaos/full/rwlhd/

Flat Navigation

Stylish navigation bar with smooth submenu. In older browsers it will display problems.
http://codepen.io/andytran/pen/YPvQQN

3D nested navigation

Horizontal menu with very cool animation without js!
http://codepen.io/devilishalchemist/pen/wBGVor

Responsive Mega Menu - Navigation

Horizontal responsive menu. Looks good, but mobile version It's a little lame. CSS, html and js are used.
http://codepen.io/samiralley/pen/xvFdc

Pure Css3 Menu

Original menu. With simple and clean code without js. Use for "wow" effects.
http://codepen.io/Sonick/pen/xJagi

Full CSS3 Dropdown Menu

Colorful drop-down menu with one nesting level. Icons from font-awesome, html and css are used.
http://codepen.io/daniesy/pen/pfxFi

Css3 only dropdown menu

A fairly good horizontal menu with three levels of nesting. Works without js.
http://codepen.io/riogrande/pen/ahBrb

Dropdown Menus

Minimalistic menu with original effect the appearance of a nested list of elements. I'm glad that this solution is also without javascript.
http://codepen.io/kkrueger/pen/qfoLa

Pure CSS DropDown Menu

Primitive, but effective solution. Only css and html.
http://codepen.io/andornagy/pen/xhiJH

Pull Menu - Menu Interaction Concept

Interesting menu concept for mobile phone. I've never seen anything like this before. Uses html, css and javascript.
http://codepen.io/fbrz/pen/bNdMwZ

Make Simple Dropdown Menu

Clean and simple code, no js. It will definitely work in ie8.
http://codepen.io/nyekrip/pen/pJoYgb

Pure CSS dropdown

The solution is not bad, but it uses too many classes. I'm glad there's no js.
http://codepen.io/jonathlee/pen/mJMzgR

Dropdown Menu

Nice vertical menu with minimal javascript code. JQuery is not used!
http://codepen.io/MeredithU/pen/GAinq

CSS 3 Dropdown Menu

A horizontal menu with additional captions can decorate your website well. The code is simple and clear. Javascript is not used.
http://codepen.io/ibeeback/pen/qdEZjR

Beautiful solution with a lot of code (html, css and js). 3 submenu formats have been created. The solution is well suited for online stores.
http://codepen.io/martinridgway/pen/KVdKQJ

CSS3 Menu Dropdowns (special solution)!

Dark horizontal menu with thirteen (13) animation options! I definitely advise you to read it, it will be useful in everyday life.
http://codepen.io/cmcg/pen/ofFiz

P.S.
I hope you liked the collection of 23 solutions. If you want to continue reading them, then take the survey below.
Enjoy your work everyone.

2. Creative animated CSS menu 3

Some interesting ideas for the menu using css3 animation.

3. Menu with blur effect

Some interesting ideas for a blurred menu using css3 for flat design.

4. Circle Navigation

Beautiful css3 navigation with circle slider thumbnails.

5. Gallery with floating thumbnails

Gallery using HTML5, CSS3 and jQuery. The highlight is that after hovering the element slightly changes its position.

6. CSS3 regulator

Control knob, well suited for volume control. Made using css3 and jquery.

7. Classic breaking news animation

Interesting idea for a news site. The appearance of hot news in the classic cinema style but with new css3 technologies.

8. Service “Photo from web camera” on css3

A cool service where you can take your photo from a web camera and look at those who have already left them. Here, of course, not only css3 is used, but also php + jquery

9. css3 dropdown menu

Drop-down menu for a website with thumbnails using jquery and css3.

10. Responsive template css3

Responsive template using only css3. The template displays correctly on any screen size.

11. Loading animation

Beautiful loading animation using css3.

12. Hover-2 css3 effect

Another css3 effect when hovering over a block.

13. Loading animation 2

Loading bar for a website using css3

14. css3 loading loop

Animation endless loading for your website using css3.

15. Original presentation contact pages

Interesting and smooth effect css3 for information to appear when hovering over a thumbnail.

Hints for a site using css3.

17. Clock on css3 and jquery

Lungs Digital Watch for your website.

18. Polaroid Gallery

A gallery in the form of scattered Polaroid photos that you can move with your cursor.

20. Juicy Tabs

21. Circles on the background

An interesting idea for a website background using pure css3 and a little jquery.

22. Dropdown, flying menu CSS3

Fly-out menu, or rather information about the menu item using css3 and jquery

23. CSS3 Miniature Menu

CSS3 menu in minimalist style.

24. Site Notices

Notifications for your site in the form of a drop-down block, everything works on css3 and jquery.

25. Thumbnails with pseudo elements

An interesting idea for thumbnails on a website with photographs.

26. Menu accordion

Convenient and beautiful menu accordion for a website without jquery.

27. Original tooltip

Tips for your website on new technology using css3.0 and jquery.

28. Folded Ribbons in CSS3

Now, to create the effect of folded ribbons, you don’t need to use a graphical editor, just write a few lines of CSS.

29. Navigation using pure html and css3

The main menu on the site using just one code.

30. CSS tags

Tags in the form of tickets for the site.

31. Motion Animation with CSS3

When you point at a block, the object begins to move.

32. Teaser for the site

Easily tease with just one code.

33. CSS3 Image Rotation

Rotate an image by a specific angle using rotate.

34. Tooltip with image

Hints that work when hovering or clicking on mobile devices.

35. Radial menu

A circular menu is a rather interesting and proven idea over the years, which is still relevant today.

36. Form feedback CSS3

The feedback form is made with field validation and hints in html5 and css3.

37. Navigator

If your website is more than just a single web page, then you should consider adding a navigation bar (menu). Menu is a section of a website designed to help visitors navigate the site. Any menu is a list of links leading to internal pages site. The most in a simple way adding a navigation bar to a site is creating a menu with using CSS and HTML.

Vertical menu

The first step of creating vertical menu will create a bulleted list. We will also need to be able to identify the list, so we will add an id attribute to it with the identifier "navbar". Each element

  • our list will contain one link:

    Our next task is to reset the default list styles. We need to remove the outer and inner padding from the list itself and the bullets from the list items. Then set the desired width:

    #navbar ( margin: 0; padding: 0; list-style-type: none; width: 100px; )

    Now it's time to style the links themselves. We will add to them background color, change the text parameters: color, font size and weight, remove the underlining, add small indents and redefine the display element from inline to block. Additionally, left and bottom frames have been added to the list items.

    The most important part of our changes is the redefinition of inline elements to block elements. Now our links occupy all the available space of the list items, that is, to follow the link we no longer need to hover the cursor exactly over the text.

    #navbar a ( background-color: #949494; color: #fff; padding: 5px; text-decoration: none; font-weight: bold; border-left: 5px solid #33ADFF; display: block; ) #navbar li ( border-left: 10px solid #666; border-bottom: 1px solid #666; )

    We have combined all the code described above into one example, now by clicking on the try button you can go to the example page and see the result:

    Document title #navbar ( margin: 0; padding: 0; list-style-type: none; width: 100px; ) #navbar li ( border-left: 10px solid #666; border-bottom: 1px solid #666; ) # navbar a ( background-color: #949494; color: #fff; padding: 5px; text-decoration: none; font-weight: bold; border-left: 5px solid #33ADFF; display: block; )

    Try »

    When you hover your mouse over a menu item, it appearance can change to attract the user's attention. You can create such an effect using the pseudo-class:hover.

    Let's return to the vertical menu example discussed earlier and add the following rule to the style sheet:

    #navbar a:hover ( background-color: #666; border-left: 5px solid #3333FF; ) Try »

    Horizontal menu

    In the previous example, we looked at the vertical navigation bar, which is most often found on websites to the left or right of the main content area. However, menus with navigation links are also often located horizontally at the top of the web page.

    A horizontal menu can be created by styling regular list. Display property for elements

  • you need to assign the value inline so that the list items are located one after another.

    To place menu items horizontally, first create bulleted list with links:

    Let's write a couple of rules for our list that reset the default style used for lists, and redefine the list items from block to inline:

    #navbar ( margin: 0; padding: 0; list-style-type: none; ) #navbar li ( display: inline; ) Try »

    Now all we have to do is define the styling for our horizontal menu:

    #navbar ( margin: 0; padding: 0; list-style-type: none; border: 2px solid #0066FF; border-radius: 20px 5px; width: 550px; text-align: center; background-color: #33ADFF; ) #navbar a ( color: #fff; padding: 5px 10px; text-decoration: none; font-weight: bold; display: inline-block; width: 100px; ) #navbar a:hover ( border-radius: 20px 5px ; background-color: #0066FF; ) Try »

    Drop-down menu

    The menu we will create will have the main navigation links located in horizontal panel navigation, and sub-items that will be displayed only after hovering the mouse over the menu item to which these sub-items relate.

    First we need to create the HTML structure of our menu. We will place the main navigation links in a bulleted list:

    We will place the sub-items in a separate list, nesting it in the element

  • , which contains the parent link regarding the sub-items. Now we have a clear structure for our future navigation bar:

    Try »

    Now let's get started writing CSS code. First, you need to hide the list with sub-items using the display: none; declaration so that they are not displayed on the web page all the time. To display sub-items, we need that when hovering over an element

  • the list has been converted to a block element again:

    #navbar ul ( display: none; ) #navbar li:hover ul ( display: block; )

    We remove the default indents and markers from both lists. We make list elements with navigation links floating, forming a horizontal menu, but for list elements containing sub-items we set float: none; so that they appear below each other.

    #navbar, #navbar ul ( margin: 0; padding: 0; list-style-type: none; ) #navbar li ( float: left; ) #navbar ul li ( float: none; )

    Next, we need to make sure our dropdown submenu doesn't push the content below the navigation bar down. To do this, we will set the list items position: relative; , and a list containing sub-items position: absolute; and add a top property with a value of 100% so that the absolutely positioned submenu appears exactly below the link.

    #navbar ul ( display: none; position: absolute; top: 100%; ) #navbar li ( float: left; position: relative; ) #navbar ( height: 30px; ) Try »

    The height for the parent list was added on purpose, since browsers do not consider floating content as element content, without adding height our list will be ignored by the browser and the content following the list will wrap around our menu.

    Now we just need to style both of our lists and the drop-down menu will be ready:

    #navbar ul ( display: none; background-color: #f90; position: absolute; top: 100%; ) #navbar li:hover ul ( display: block; ) #navbar, #navbar ul ( margin: 0; padding: 0; list-style-type: none; ) #navbar ( height: 30px; background-color: #666; padding-left: 25px; min-width: 470px; ) #navbar li ( float: left; position: relative; height: 100%; ) #navbar li a ( display: block; padding: 6px; width: 100px; color: #fff; text-decoration: none; text-align: center; ) #navbar ul li ( float: none; ) #navbar li:hover ( background-color: #f90; ) #navbar ul li:hover ( background-color: #666; )

    Most classic websites on the Internet use a horizontal menu as the main navigation element. Sometimes it may contain various additional features - multi-level structures, icons for sub-items, a search block, complex lists, etc. Recently there was a small selection on the blog, but today we’ll look at 4 practical examples how to make a dropdown menu using CSS + HTML. The information will be useful for novice developers and those who want to change the navigation on their website.

    The first CSS3 Dropdown Menu tutorial is the newest in the collection (from April 2016). Pros of the solution: in this horizontal drop-down menu for the site, the sub-items contain icons, the implementation and the CSS code itself are quite simple to understand and implement.

    Step1 - HTML markup

    The first step is to create an unordered list in HTML with anchor links (#) for its elements. There, in one of the items, we add another nested list, which will be responsible for the submenu.

    Step2 - Display the menu

    We remove unnecessary indents in CSS for elements of the site's horizontal drop-down menu. At the same stage we will install fixed width and the height of the menu items, and also add rounded corners.

    .menu, .menu ul, .menu li, .menu a ( margin : 0 ; padding : 0 ; border : none ; outline : none ; ) .menu ( height : 40px ; width : 505px ; background : #4c4e5a ; background : -webkit-linear-gradient(top , #4c4e5a 0% , #2c2d33 100% ) ; background : -moz-linear-gradient(top , #4c4e5a 0% , #2c2d33 100% ) ; background : -o-linear-gradient (top , #4c4e5a 0% , #2c2d33 100% ) ; background : -ms-linear-gradient(top , #4c4e5a 0% , #2c2d33 100% ) ; background : linear-gradient(top , #4c4e5a 0% , # 2c2d33 100% ) ; -webkit-border-radius: 5px ; -moz-border-radius: 5px ; border-radius : 5px ; ) .menu li ( position : relative ; list-style : none ; float : left ; display : block ; height : 40px ; )

    Menu, .menu ul, .menu li, .menu a ( margin: 0; padding: 0; border: none; outline: none; ) .menu ( height: 40px; width: 505px; background: #4c4e5a; background: - webkit-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -moz-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: -o-linear-gradient( top, #4c4e5a 0%,#2c2d33 100%); background: -ms-linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); background: linear-gradient(top, #4c4e5a 0%,#2c2d33 100%); -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; ) .menu li ( position: relative; list-style: none; float: left; display: block ; height: 40px; )

    Step3 - linking

    In addition to the basic features in styles (font, color, height), we use and create smooth transition hover text colors. We also add separators to the menu, removing the border from the first element on the left and from the last on the right.

    .menu li a ( display : block ; padding : 0 14px ; margin : 6px 0 ; line-height : 28px ; text-decoration : none ; border-left : 1px solid #393942 ; border-right : 1px solid #4f5058 ; font -family : Helvetica, Arial, sans-serif ; font-weight : bold ; font-size : 13px ; color : #f3f3f3 ; text-shadow : 1px 1px 1px rgba (0 , 0 , 0 , .6) ; -webkit- transition: color .2s ease-in-out; -moz-transition: color .2s ease-in-out; -o-transition: color .2s ease-in-out; -ms-transition: color .2s ease-in -out; transition : color .2s ease-in-out; ) .menu li: first-child a ( border-left : none ; ) .menu li: last-child a( border-right : none ; ) .menu li : hover > a ( color : #8fde62 ; )

    Menu li a ( display: block; padding: 0 14px; margin: 6px 0; line-height: 28px; text-decoration: none; border-left: 1px solid #393942; border-right: 1px solid #4f5058; font- family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 13px; color: #f3f3f3; text-shadow: 1px 1px 1px rgba(0,0,0,.6); -webkit-transition : color .2s ease-in-out; -moz-transition: color .2s ease-in-out; -o-transition: color .2s ease-in-out; -ms-transition: color .2s ease-in- out; transition: color .2s ease-in-out; ) .menu li:first-child a ( border-left: none; ) .menu li:last-child a( border-right: none; ) .menu li: hover > a ( color: #8fde62; )

    Step4 - submenu

    Since we have a drop-down site menu using CSS, we should also set a design for the nested list. First, set a margin of 40px on top and 0px on the left + add rounded corners. To show/hide the submenu, initially set the opacity property to zero, and when hovering it to one. To create the effect of a submenu appearing, set the value of the list height to zero, and with hover = 36px.

    .menu ul ( position : absolute ; top : 40px ; left : 0 ; opacity : 0 ; background : #1f2024 ; -webkit-border-radius: 0 0 5px 5px ; -moz-border-radius: 0 0 5px 5px ; border -radius : 0 0 5px 5px ; -webkit-transition: opacity .25s ease .1s ; -moz-transition: opacity .25s ease .1s ; -o-transition: opacity .25s ease .1s ; -ms-transition: opacity .25s ease .1s ; transition : opacity .25s ease .1s ; ) .menu li: hover > ul ( opacity : 1 ; ) .menu ul li ( height : 0 ; overflow : hidden ; padding : 0 ; -webkit-transition : height .25s ease .1s ; -moz-transition: height .25s ease .1s ; -o-transition: height .25s ease .1s ; -ms-transition: height .25s ease .1s ; transition : height .25s ease .1s ; ) .menu li: hover > ul li ( height : 36px ; overflow : visible ; padding : 0 ; )

    Menu ul ( position: absolute; top: 40px; left: 0; opacity: 0; background: #1f2024; -webkit-border-radius: 0 0 5px 5px; -moz-border-radius: 0 0 5px 5px; border- radius: 0 0 5px 5px; -webkit-transition: opacity .25s ease .1s; -moz-transition: opacity .25s ease .1s; -o-transition: opacity .25s ease .1s; -ms-transition: opacity . 25s ease .1s; transition: opacity .25s ease .1s; ) .menu li:hover > ul ( opacity: 1; ) .menu ul li ( height: 0; overflow: hidden; padding: 0; -webkit-transition: height .25s ease .1s; -moz-transition: height .25s ease .1s; -o-transition: height .25s ease .1s; -ms-transition: height .25s ease .1s; transition: height .25s ease . 1s; ) .menu li:hover > ul li ( height: 36px; overflow: visible; padding: 0; )

    We set the width of the links = 100px, a border-bottom border is added at the bottom of all elements except the last one. Also, if you wish, you can place pictures for the submenu items (attention! do not forget to change the paths to the images in the code to the ones you use).

    .menu ul li a ( width : 100px ; padding : 4px 0 4px 40px ; margin : 0 ; border : none ; border-bottom : 1px solid #353539 ; ) .menu ul li : last-child a ( border : none ; ) .menu a.documents ( background : url (../img/docs.png ) no-repeat 6px center ; ) .menu a.messages ( background : url (../img/bubble.png ) no-repeat 6px center ; ) .menu a.signout ( background : url (../img/arrow.png ) no-repeat 6px center ; )

    Menu ul li a ( width: 100px; padding: 4px 0 4px 40px; margin: 0; border: none; border-bottom: 1px solid #353539; ) .menu ul li:last-child a ( border: none; ) . menu a.documents ( background: url(../img/docs.png) no-repeat 6px center; ) .menu a.messages ( background: url(../img/bubble.png) no-repeat 6px center; ) .menu a.signout ( background: url(../img/arrow.png) no-repeat 6px center; )

    I personally like the ease of implementation and the use of icons. Here is the final code from codepen:

    Josh Riser's option is visually similar to the previous HTML and CSS dropdown menu. Not in the code child selector" > " (useful in multi-level designs), but the author makes good use of CSS3 effects (transition, box-shadow and text-shadow) for a more beautiful result. The link in the source does not describe the process of creating a horizontal drop-down menu, so I will immediately provide the final code:

    IN in this example We will look at how to make a drop-down menu using CSS, which in addition to the items will contain a search block. A similar implementation can often be found in modern . In terms of implementation time and complexity, the solution is a little more complicated than the previous ones. It was published in May 2013, so you may need to tweak some things, although it worked fine in our testing.

    HTML code

    For navigation, as always, an unordered list (with the nav class) is used. Regular menu items are list items (li) and contain links (a href) without any classes or IDs. The exception is 3 specialized elements of this horizontal drop-down menu with the following IDs:

    • settings — link picture;
    • search — a block with a search and a corresponding button;
    • options - contains a submenu (implemented through a list with the subnav class).

    Also in the code you will see a prefixfree script for using CSS properties without prefixes. Final HTML option for the drop-down menu looks like:

    Menu CSS

    1. Basic styles and menu elements

    First, we specify the Montserrat font, a dark gray background, and a fixed height for the menu items. All elements have float: left alignment and relative positioning so that later you can add a submenu with position: absolute;

    @import url (http: //fonts.googleapis.com/css?family= Montserrat) ; * ( margin : 0 ; padding : 0 ; ) .nav ( background : #232323 ; height : 60px ; display : inline-block ; ) .nav li ( float : left ; list-style-type : none ; position : relative ; )

    @import url(http://fonts.googleapis.com/css?family=Montserrat); * ( margin: 0; padding: 0; ) .nav ( background: #232323; height: 60px; display: inline-block; ) .nav li ( float: left; list-style-type: none; position: relative; )

    2. Formatting links

    Menu items use the basic design + . The height is the same as in the nav class. For #settings the image link at the beginning of the menu, the alignment is set.

    .nav li a ( font-size : 16px ; color : white ; display : block ; line-height : 60px ; padding : 0 26px ; text-decoration : none ; border-left : 1px solid #2e2e2e ; font-family : Montserrat , sans-serif ; text-shadow : 0 0 1px rgba ( 255 , 255 , 255 , 0.5 ) ; ) .nav li a: hover ( background-color : #2e2e2e ; ) #settings a ( padding : 18px ; height : 24px ; font-size : 10px ; line-height : 24px ; )

    Nav li a ( font-size: 16px; color: white; display: block; line-height: 60px; padding: 0 26px; text-decoration: none; border-left: 1px solid #2e2e2e; font-family: Montserrat, sans-serif; text-shadow: 0 0 1px rgba(255, 255, 255, 0.5); ) .nav li a:hover ( background-color: #2e2e2e; ) #settings a ( padding: 18px; height: 24px; font-size: 10px; line-height: 24px; )

    3. Search block

    This element has a fixed width and consists of several parts - an input field (#search_text) with a green background and a search button (#search_button). In some browsers, the background color may be gray.

    #search ( width : 357px ; margin : 4px ; ) #search_text ( width : 297px ; padding : 15px 0 15px 20px ; font-size : 16px ; font-family : Montserrat, sans-serif ; border : 0 none ; height : 52px ; margin-right : 0 ; color : white ; outline : none ; background : #1f7f5c ; float : left ; box-sizing : border-box ; transition : all 0.15s ; ) :: -webkit-input-placeholder ( /* WebKit browsers */ color : white ; ) : -moz-placeholder ( /* Mozilla Firefox 4 to 18 */ color : white ; ) :: -moz-placeholder ( /* Mozilla Firefox 19+ */ color : white ; ) : -ms-input-placeholder ( /* Internet Explorer 10+ */ color : white ; ) #search_text : focus ( background : rgb (64 , 151 , 119 ) ; ) #search_button ( border : 0 none ; background : #1f7f5c url (search.png ) center no-repeat ; width : 60px ; float : left ; padding : 0 ; text-align : center ; height : 52px ; cursor : pointer ; )

    #search ( width: 357px; margin: 4px; ) #search_text( width: 297px; padding: 15px 0 15px 20px; font-size: 16px; font-family: Montserrat, sans-serif; border: 0 none; height: 52px ; margin-right: 0; color: white; outline: none; background: #1f7f5c; float: left; box-sizing: border-box; transition: all 0.15s; ) ::-webkit-input-placeholder ( /* WebKit browsers */ color: white; ) :-moz-placeholder ( /* Mozilla Firefox 4 to 18 */ color: white; ) ::-moz-placeholder ( /* Mozilla Firefox 19+ */ color: white; ) : -ms-input-placeholder ( /* Internet Explorer 10+ */ color: white; ) #search_text:focus ( background: rgb(64, 151, 119); ) #search_button ( border: 0 none; background: #1f7f5c url (search.png) center no-repeat; width: 60px; float: left; padding: 0; text-align: center; height: 52px; cursor: pointer; )

    4. Dropdown submenu

    The final touch will allow us to make a drop-down menu in CSS that fires for the last #options item.

    #options a( border-left : 0 none ; ) #options > a ( background-image : url (triangle.png ) ; background-position : 85% center ; background-repeat : no-repeat ; padding-right : 42px ; ) .subnav ( visibility : hidden ; position : absolute ; top : 110% ; right : 0 ; width : 200px ; height : auto ; opacity : 0 ; transition : all 0.1s ; background : #232323 ; ) .subnav li ( float : none ; ) .subnav li a ( border-bottom : 1px solid #2e2e2e ; ) #options : hover .subnav ( visibility : visible ; top : 100% ; opacity : 1 ; )

    #options a( border-left: 0 none; ) #options>a ( background-image: url(triangle.png); background-position: 85% center; background-repeat: no-repeat; padding-right: 42px; ) .subnav ( visibility: hidden; position: absolute; top: 110%; right: 0; width: 200px; height: auto; opacity: 0; transition: all 0.1s; background: #232323; ) .subnav li ( float : none; ) .subnav li a ( border-bottom: 1px solid #2e2e2e; ) #options:hover .subnav ( visibility: visible; top: 100%; opacity: 1; )

    In the styles you will find an insert background image triangle (triangle.png) to indicate a submenu - do not forget to indicate the correct path for this and other images in the example. The appearance of a submenu is implemented using opacity properties. Final solution on codepen:

    IN this option CSS2.1 techniques are mainly used, the solution plus or minus is new - for March 2015. If you are missing one sublevel in a horizontal drop-down menu for a site, then this example contains three at once. Using the pseudo-class:only-child, a “+” symbol is added to items to indicate the presence of a submenu.

    Overall, a good and simple example. We will not describe the implementation process in detail, because... it is similar to the previous ones - first you create an HTML framework, and then gradually add styles for it. Download the final code using the link to the source; you can partially view it in Codepen:

    Total

    Above we looked at 4 options for how to make a drop-down menu using CSS + HTML for, although there are many more similar examples on the Internet. There are solutions with jQuery, but this is most likely only useful for implementing some special effects and non-standard tasks. In most cases, a combination of CSS + HTML will be enough, especially since now the main requirements for a menu are convenience and fast speed downloads.

    Finally, two notes on the codes above. Some examples use images for the dropdown menu in CSS, so you will have to carefully review the image paths and specify correct values for your site. Secondly, some of the solutions are 2-3 years old, so you should once again additionally check their performance in different browsers.

    If you know any other interesting modern implementations of horizontal drop-down menus for a website, send links in the comments.

    CSS3 changes the technology of creating websites. While many are reluctant to start using CSS3 due to the lack of support in some browsers, there are those who are going ahead and creating amazing things using the amazing features of CSS3. You no longer need to rely on scripts and images to create stylish website elements such as buttons and menus.

    You can create a modern menu without Javascript or images by effectively using the new CSS3 properties: border radius and animation. This menu works great with Firefox, Opera, Chrome and Safari. The dropdown menu also works in browsers that do not support CSS3, such as IE7+, but rounded corners and shadows will not be displayed. CSS3 effects will one day replace everything jQuery animation, which is used by designers.

    Menu features Get full version

    A fee is required for commercial use. The business version of CSS3Menu additionally provides the option to create a multi-column menu and includes an expanded set of menu templates and icons.

    Once you complete your payment via a secure form, you will immediately receive your license information via e-mail. You can choose the most suitable payment method: credit card, bank transfer, check, PayPal, etc.

    • Download free version
      for Windows & Mac
    • Download commercial version
      for Windows & Mac - $59
    Help How to create a stylish animated CSS3 menu without JavaScript

    1) Open the CSS3 Menu application, click the "Add Item" and "Add Submenu" buttons located on the CSS3 Menu toolbar to create a menu. You can also use the "Delete element" button to remove some buttons.

    2) Use ready-made templates. To do this, select the theme you like from the "Templates" list. Double click on a theme to apply it.

    3) Customize the appearance of the menu.
    3.1. Click on the element and change the button appearance settings for normal and hovered states, set the link and the value of the Target attribute on the "Main Menu" tab.
    3.2. Click on an element and change the appearance of the submenu for normal and hover states, set the link and the value of the Target attribute on the "Submenu" tab.

    4) Saving the menu.
    4.1. Saving the project file. To save the project, simply click the "Save" button located on the toolbar or select "Save" or "Save..." in the main menu.
    4.2. Publishing menus in HTML format. To do this, click the "Publish" button on the toolbar.

    Connect with us

    CSS3 Menu
    If you find errors in the operation of the program, or have any questions or suggestions, please contact technical support. Make sure your email includes information about your browser, OS, CSS3Menu version, and a link to your page. In most cases you will receive a response within one business day. Please read the FAQ first. Your question may have already been answered.
    Email:





  • 

    2024 gtavrl.ru.