Why is building a drop down menu in css so hideously complicated to code, and how can one avoid getting completely lost in the amalgamation with so many variables everywhere?
-
I currently have 14 selectors in my CSS all trying to achieve what I believe to be a simple drop down menu that highlights on hover and highlights when active. I've reached a point where I am totally befuddled by the mess that is before me: #menu { position:relative; top:-17px; left:220px; margin:0px; padding:0px; z-index:10; font-size:15px; color:#292929; } #menu ul { margin:0px; padding:0px; line-height:30px; } #menu li { list-style:none; text-indent:10px; height:32px; padding:0px; margin:0px; float:left; position:relative; } #menu ul li a { text-decoration:none; display:block; } #menu ul a:hover { color:#FFFFFF; } #top:hover { background:#F03A37; color:#FFFFFF; } #top2:hover { background:#F03A37; color:#FFFFFF; } #top { width:140px; } #top2 { width:210px; } ul#menu li:hover ul.sub-menu { visibility:visible; } ul.sub-menu { position:absolute; visibility:hidden; padding:0px; top:32px; } ul.sub-menu li { background:#F03A36; opacity:0.8; width:250px; } ul.sub-menu li a { color:#FFFFFF; } ul.sub-menu li:hover { background:#F9A6A4; }
-
Answer:
Any thing is simple if someone worked hard on it. As an example, I can say that our project Menu Generator taken years...
Andrei Pogorelov at Quora Visit the source
Other answers
Looks like you're working on an abstraction layer that's not suited to your goals. Unless you'reĀ interested in defining yourself as a CSS3 coder and dynamic menu maintainer, you should base your work on existing dynamic menu libraries or adopt a framework that already does so. Without such a strategy, you'll never be productive enough. Enjoy the learning curve and congratulations for your new found appreciation of those simple enough things we see everywhere and take for granted.
Anonymous
SASS. Or LESS. Work with actual variables, nest your selectors, append selectors and then, king of all, make a Mixin so that you don't have to do this ever again.
Alexandra Dickman
Each time i code a new drop down menu only with the use of CSS I am finding new ways to make them more and more simple. It's a good thing to improve yours skills but at the end of the day just use jquery to create better menus :) JavaScript rules the web in our days.
Vagelis Grassos
Related Q & A:
- How can I find my long lost relative in the US?Best solution by Yahoo! Answers
- How can one start a non-profit organization?Best solution by Yahoo! Answers
- How can I accomplish getting a peaceful home with my siblings, mom, etc?Best solution by Yahoo! Answers
- How can I avoid getting tired while I study?Best solution by Yahoo! Answers
- How can one obtain a G.E.D?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.