r/HTML • u/dalekellytoo • Oct 28 '26
Main Menu
How can I do the main menu on ...
?
I have seen this on a lot of sites.
I think it would be better than how I do a main menu for different sizes of browser's windows.
Looked at the code on the Chrome Browser but can't figure it out.
Prefer no scripts.
2
Upvotes
5
u/alphex Oct 28 '26
The best part about websites, is that you can view the source, and learn how they do it by reading the code.
They treat each main menu item as a button, which they use to trigger the drop down to show, using javascript. If you're teaching your self how to code HTML, then CSS and JS is your next step in the path.
1
u/dalekellytoo Oct 28 '26
thank you !
here is how far I got without something like an "include"
9 main menu items, 15 others on "thoughts"
https://www.dalekelly.org/
https://www.dalekelly.org/mystyle5.css
menu seems to be further to the left than the pages, I like the page to be centered on HOME page, pages are much worse on smart phone
I think this is a CSS or <style> thing I have to look into
1
u/SirMcFish Oct 28 '26
google Horizontal navbar: https://www.w3schools.com/css/css_navbar_horizontal.asp that'll help you out a lot more than trying to view the source. There are many ways to get the final rendered HTML these days, and the final bit you see and can see in source, really won't tell you how it was done
1
u/marmotta1955 Oct 28 '26
I think others have already suggested https://www.w3schools.com/w3css/w3css_navigation.asp
That is all you really need