{"id":11894,"date":"2020-03-13T01:44:05","date_gmt":"2020-03-13T05:44:05","guid":{"rendered":"http:\/\/info.template-help.com\/?p=11894"},"modified":"2020-03-13T06:17:44","modified_gmt":"2020-03-13T10:17:44","slug":"htmlcss-how-to-create-vertical-and-horizontal-menu","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/htmlcss-how-to-create-vertical-and-horizontal-menu.html","title":{"rendered":"HTML\/CSS. How to create vertical and horizontal menu"},"content":{"rendered":"<p>This tutorial will show you how to create a vertical and horizontal menus in HTML using CSS styles. Before you proceed please make sure you are familiar with unordered list HTML tags. <!--more-->Also please check the tutorial on<a href=\"\/help\/html-how-to-create-a-menu.html\"> how to create a menu in HTML<\/a>. <\/p>\r\n<p>Ok, first of all create an HTML menu using the unordered list:<\/p>\r\n\r\n<pre class=\"brush:html\">\r\n&lt;ul&gt;\r\n&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;li&gt;&lt;a href=&quot;#&quot;&gt;About&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Services&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Partners&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contacts&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;\/ul&gt;\r\n<\/pre>\r\n\r\n<p>Then you need to create new CSS file and attach it to the HTML page:<\/p>\r\n\r\n<pre class=\"brush:html\">\r\n  &lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; \/&gt;\r\n<\/pre>\r\n\r\n<p class=\"tip\">Make sure you put the CSS attachement code into the &lt;head&gt; tag of your html page. <\/p>\r\n<p> You can also use the inline styles. <\/p>\r\n\r\n<pre class=\"brush:css\">\r\n\t&lt;style type=\"text\/css\"&gt;\r\n\t\t...here goes your CSS styles...\r\n\t&lt;\/style&gt; \r\n<\/pre>\r\n\r\n<p>As a result you shou have the following HTMl code:<\/p>\r\n\r\n<pre class=\"brush:html\">\r\n&lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd&quot;&gt;\r\n&lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt;\r\n\r\n&lt;head&gt;\r\n\t&lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; \/&gt;\r\n&lt;\/head&gt;\r\n\r\n&lt;body&gt;\r\n\r\n&lt;ul&gt;\r\n\t&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;\/a&gt;&lt;\/li&gt;\r\n\t&lt;li&gt;&lt;a href=&quot;#&quot;&gt;About&lt;\/a&gt;&lt;\/li&gt;\r\n\t&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Services&lt;\/a&gt;&lt;\/li&gt;\r\n\t&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Partners&lt;\/a&gt;&lt;\/li&gt;\r\n\t&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contacts&lt;\/a&gt;&lt;\/li&gt;\r\n&lt;\/ul&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\r\n\r\n<p>The unordered list has it&#8217;s own styles so without any additional changes you have a vertical menu. <\/p>\r\n<p>As for the horizontal menu you need to perform some changes in HTML and CSS. <\/p>\r\n<p><\/p>\r\n<p>First of all add new class to the list, replace <span class=\"brush:css\">&lt;ul&gt;<\/span> with <span class=\"brush:css\">&lt;ul class=&quot;horizontal&quot;&gt;<\/span><\/p>\r\n<p>Now in the CSS file let&#8217;s make the menu horizontal. The unordered list has margin and padding values assigned by default. we need to clear them:<\/p>\r\n\r\n<pre class=\"brush:css\">\r\nul.horizontal{\r\nmargin:0;\r\npadding:0;\r\n}\r\n<\/pre>\r\n\r\n<p>Then make your list items display horizontally:<\/p>\r\n\r\n<pre class=\"brush:css\">\r\nul.horizontal li{\r\ndisplay:block;\r\nfloat:left;\r\npadding:0 10px;\r\n}\r\n<\/pre>\r\n\r\n<p>We added the horizontal padding value to the list items to make then not stick to each other. Now your menu is ready, assign links, add some fancy colors and background and your are good to go. <\/p>\r\n\r\n<hr \/>\r\n\r\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.templatemonster.com\/javascript\/zemez-responsive-navbar-javascript-94576.html\" target=\"_blank\" rel=\"noopener noreferrer\">Zemez Responsive Navbar JavaScript<\/a><p\/>\r\n\r\n<img loading=\"lazy\" src=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/11\/zemez-responsive-navbar-javascript.jpg\" alt=\"Zemez Responsive Navbar JavaScript.\" width=\"760\" height=\"435\" class=\"alignnone size-full wp-image-86552\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/11\/zemez-responsive-navbar-javascript.jpg 760w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/11\/zemez-responsive-navbar-javascript-150x86.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2011\/11\/zemez-responsive-navbar-javascript-300x172.jpg 300w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/>\r\n\r\n<p style=\"text-align: center;\"><a class=\"btn\" href=\"https:\/\/www.templatemonsterpreview.com\/demo\/94576.html\" target=\"_blank\" rel=\"noopener noreferrer\">Demo<\/a> | <a class=\"btn\" href=\"https:\/\/www.templatemonster.com\/javascript\/zemez-responsive-navbar-javascript-94576.html\" target=\"_blank\" rel=\"noopener noreferrer\">Download<\/a><\/p>\r\n\r\n<p>The average user has neither time nor patience to surf your website in search of the required information. Difficult-to-use navigation makes the user feel awkward and may leave the site anytime. Choose Zemez responsive Navbar JavaScript to avoid these mistakes and boost the functionality of your web resource.<\/p>\r\n\r\n<p>This Navbar JavaScript is a beautiful solution for those who want to add more power to a web resource. The package comes with 8 unique layouts, multi-level dropdowns and megamenus, available in light and dark color schemes. Moreover, it is cross-browser compatible as it supports Edge 15+, Firefox 54+, Chrome 51+, Safari 10+. Click the demo link to view a demonstration of this script work.<\/p>\r\n\r\n<p>More features:\r\n<ul><li>SASS<\/li>\r\n<li>Sticky navbar<\/li>\r\n<li>Fixed and fullwidth layouts<\/li>\r\n<li>Flexbox based<\/li>\r\n<li>Round-the-clock support<\/li><\/p>\r\n\r\n \r\n\r\n<!--more--> \r\n<!--more-->","protected":false},"excerpt":{"rendered":"<p>This tutorial will show you how to create a vertical and horizontal menus in HTML using CSS styles. Before you proceed please make sure you are familiar with unordered list HTML tags.<\/p>\n","protected":false},"author":2,"featured_media":11897,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[256],"tags":[514,2411,896,571],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/11894"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=11894"}],"version-history":[{"count":3,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/11894\/revisions"}],"predecessor-version":[{"id":86558,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/11894\/revisions\/86558"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/11897"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=11894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=11894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=11894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}