First a note about the site. It is a WIP, the pages are not linked to or indexed by search engines as yet, with the exception of the homepage which is the only live page currently and therefore has no menu yet.
So if you go on the homepage, you will need to use back in your browser to get to the other unlinked pages with menus. And that leads onto the problem, if you use Back, it does not go to the previous page, but the previous page with the menu open. The reason being that I’m using a target selector to open (display) the menu, so you go back to pagename.php#menwrap
rather than just pagename.php
which would be preferred.
.table,
.cell,
#menwrap:target,
#contact {
display: block;
}
I thought I could get around this by using a sibling selector instead of a target.
.table,
.cell,
#ham:focus + #menwrap,
#contact {
display: block ;
}
And yes, it opens the menu, but if you then click a menu item, it loses focus and just gives you the same page again with the menu hidden. Is there a better selector to use than target or focus to make this work how I want? Yes it’s normal to use js for mob menus, but I wanted to do it with css only.
Here are links to different versions of pages. This only applies to the mobile menu, so you will have to squeeze your browser up to see it in mobile mode.
This is a page with the target selector (those with php ext). I think I could live with this, but the back thing is a bit annoying.
And this one using the sibling selector (those with htm ext). The menu opens, but the links are not clickable.