0

Is there a way to open a submenu on click. Keep it open till you click again? for mobile phones. That does NOT rely on a checkbox or jquery{onclick}? I wont bore you with code as I know it can be done those ways and there are plenty of examples. I can make it open on hover using

#limenu:hover > ul.submenu

but how can i make it stay open with css only?

  • You may want to check out [`:active`](https://developer.mozilla.org/en-US/docs/Web/CSS/:active) or [`:focus`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus). – Chase Ingebritson Sep 07 '18 at 19:43
  • I don't think you can stably use CSS for 'keying'. – Dr Upvote Sep 07 '18 at 19:44
  • attribute tabindex, :focus and pointer events can fake it (tggle open /close submenu on click) but if there's links to click in the submenu not sure you can reach them.... this is a typical javascript job if click event is involved without form elements. – G-Cyrillus Sep 07 '18 at 19:54
  • If you are asking on click, you can create two css classes for Display None and Display Block.. On click you can toggle the classes on the submenu. Thanks – Nimitt Shah Sep 07 '18 at 19:56
  • You can eventually inspire yourself from an old menu pure CSS (2 sublevel) of mine https://codepen.io/gcyrillus/pen/gxcJj/ based on tabindex and focus . it also works via the tab key. don't mind the design it is ages old :) – G-Cyrillus Sep 07 '18 at 20:10
  • I believe this is what you're looking for : [Here](https://stackoverflow.com/questions/17100235/make-css-hover-state-remain-after-unhovering#answer-19962658) – Mark Salvania Sep 07 '18 at 21:26

0 Answers0