1<!DOCTYPE html>
2<html>
3<head>
4<meta name="viewport" content="width=device-width, initial-scale=1">
5<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
6<style>
7body {
8 font-family: Arial, Helvetica, sans-serif;
9}
10
11.mobile-container {
12 max-width: 480px;
13 margin: auto;
14 background-color: #555;
15 height: 500px;
16 color: white;
17 border-radius: 10px;
18}
19
20.topnav {
21 overflow: hidden;
22 background-color: #333;
23 position: relative;
24}
25
26.topnav #myLinks {
27 display: none;
28}
29
30.topnav a {
31 color: white;
32 padding: 14px 16px;
33 text-decoration: none;
34 font-size: 17px;
35 display: block;
36}
37
38.topnav a.icon {
39 background: black;
40 display: block;
41 position: absolute;
42 right: 0;
43 top: 0;
44}
45
46.topnav a:hover {
47 background-color: #ddd;
48 color: black;
49}
50
51.active {
52 background-color: #4CAF50;
53 color: white;
54}
55</style>
56</head>
57<body>
58
59<!-- Simulate a smartphone / tablet -->
60<div class="mobile-container">
61
62<!-- Top Navigation Menu -->
63<div class="topnav">
64 <a href="#home" class="active">Logo</a>
65 <div id="myLinks">
66 <a href="#news">News</a>
67 <a href="#contact">Contact</a>
68 <a href="#about">About</a>
69 </div>
70 <a href="javascript:void(0);" class="icon" onclick="myFunction()">
71 <i class="fa fa-bars"></i>
72 </a>
73</div>
74
75<div style="padding-left:16px">
76 <h3>Vertical Mobile Navbar</h3>
77 <p>This example demonstrates how a navigation menu on a mobile/smart phone could look like.</p>
78 <p>Click on the hamburger menu (three bars) in the top right corner, to toggle the menu.</p>
79</div>
80
81<!-- End smartphone / tablet look -->
82</div>
83
84<script>
85function myFunction() {
86 var x = document.getElementById("myLinks");
87 if (x.style.display === "block") {
88 x.style.display = "none";
89 } else {
90 x.style.display = "block";
91 }
92}
93</script>
94
95</body>
96</html>
97