How we can create a mega menu easily using Bootstrap, HTML, & CSS? Solution: Bootstrap Mega Menu With CSS In other words, Responsive Multiple Row Menu built-in Bootstrap library.
When we have to create a responsive site easily & fast then we definitely choose Bootstrap. Because the most important elements we use in website building they are comes with Bootstrap. On many websites, you can see mega menus for showing more information to users. Big websites like school & e-commerce always use the mega menu, because they have lots of verity or categories.
To you will learn to create a multi-row dropdown menu using Bootstrap. These types of menus called Mega Menu, A mega menu contains image, forms, links, etc. But In this menu, we added links only you can add other this that’s not difficult. When you are using bootstrap then creating all is easy. If you don’t have knowledge of bootstrap then start learning now that’s very easy. Previously I have shared many types of menus you can check out those.
So, Today I am sharing A Bootstrap Mega Menu With CSS Responsive Design. Basically, This is a multi-row menu with Bootstrap, HTML, CSS, & JavaScript. I used JavaScript for creating the toggle button for the mobile version only, nothing else. You can remove JS if you don’t want toggle button for small screens.
If you are thinking now how this mega menu actually is, then see the preview given below.
Preview Of Responsive Multiple Row Menu
See this video preview to getting an idea of how this mega or multi-row menu looks like.
Now you can see this visually. If you like this, then get the source code of its.
You May Also Like:
- Bootstrap Login Form
- HTML CSS Range Slider
- Animated Newsletter Signup Form
- Vertical Image Column Slider
Bootstrap Mega Menu With CSS Source Code
Before sharing source code, Let’s talk about it. As you know I used bootstrap for creating this mega menu. With Bootstrap I used CSS @media query to creating this responsive. For creating 3 rows I put col-md-4
, which is a bootstrap class for creating 3 rows. Actually, Bootstrap device the screen size in 12 parts (get info), what why I put col-md-4
because 4 multiply 3 equals 12.
In the CSS section, I put many things because there are lots of links and their styles. Like every section stylish, responsive values, colors, etc. The CSS part is very easy to understand, there are no difficult things or properties. There are lots of small conditions, that’s why I am not explaining that.
I used font-awesome for creating icons, Previously many time I have used this library for icons. As I told already, I just used JavaScript for creating a toggle button for small screens. In the small screen, there are no grid or multi-row menu, There options are all dropdown. When you click on the menu button on the mobile version, then all categories or links appear in dropdown order.
There is nothing to explain because they are basics also I put many links that’s why there is little difficult to explain. After getting the codes you will understand automatically, If you get any trouble to understand anything then you can ask me.
For creating this HTML CSS Bootstrap Mega Menu program, You have to create 3 files, First for HTML/Bootstrap, second for CSS, & the last one for JavaScript. Follow the steps to creating this without any error.
index.html
Create an HTML file named ‘index.html‘ and put these codes given below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
<!DOCTYPE html> <!-- code by webdevtrick ( https://webdevtrick.com ) --> <html> <head> <meta charset="UTF-8"> <title>Responsive Bootstrap Mega Menu | Webdevtrick.com</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Metrophobic"> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container"> <button id="toggle-button">Open Menu</button> <div class="row main-container"> <div class="col-md-12"> <ul class="nav nav-pills pull-right"> <li class="inside-menu"> <a href="" data-toggle="dropdown"> Web Design <b class="caret"></b> </a> <ul class="dropdown-menu menu-dropdown"> <li> <div class="container"> <div class="row"> <div class="mega-menu clearfix"> <div class="col-md-4"> <div class="menu-section"> <div class="menu-head"> <div class="menu-head-icon-1"> <i class="fa fa-battery-half"></i> </div> <div class="menu-head-title"> Basic </div> </div> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> HTML </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> CSS </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> JavaScript </div> </a> </div> </div> <div class="col-md-4"> <div class="menu-section"> <div class="menu-head"> <div class="menu-head-icon-1"> <i class="fa fa-rocket"></i> </div> <div class="menu-head-title"> Softwares </div> </div> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Adobe Photoshop </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Adobe Illustrator </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Adove XD </div> </a> </div> </div> <div class="col-md-4"> <div class="menu-section"> <div class="menu-head"> <div class="menu-head-icon-1"> <i class="fa fa-battery-full"></i> </div> <div class="menu-head-title"> Advance </div> </div> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> jQuery </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Bootstrap </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> jQuery UI </div> </a> </div> </div> </div> </div> </div> </li> </ul> </li> <li class="inside-menu"> <a href="" data-toggle="dropdown"> Web Development <b class="caret"></b></a> <ul class="dropdown-menu menu-dropdown"> <li> <div class="container"> <div class="row"> <div class="mega-menu clearfix"> <div class="col-md-4"> <div class="menu-section"> <div class="menu-head"> <div class="menu-head-icon-1"> <i class="fa fa-terminal"></i> </div> <div class="menu-head-title" title="Web Development"> Frontent </div> </div> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> React </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Vue </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Angular </div> </a> </div> </div> <div class="col-md-4"> <div class="menu-section"> <div class="menu-head"> <div class="menu-head-icon-1"> <i class="fa fa-code"></i> </div> <div class="menu-head-title" title="Web Development"> Backend </div> </div> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> PHP </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Node JS </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Python </div> </a> </div> </div> <div class="col-md-4"> <div class="menu-section"> <div class="menu-head"> <div class="menu-head-icon-1"> <i class="fa fa-database"></i> </div> <div class="menu-head-title" title="Web Development"> Database </div> </div> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> MySQL </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> SQLite </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Mongo DB </div> </a> </div> </div> </li> </ul> </li> <li class="inside-menu"> <a class="" href="" data-toggle="dropdown">SEO <b class="caret"></b></a> <ul class="dropdown-menu menu-dropdown"> <li> <div class="container"> <div class="row"> <div class="mega-menu clearfix"> <div class="col-md-12"> <div class="menu-section"> <div class="menu-head"> <div class="menu-head-icon-1"> <i class="fa fa-search-plus"></i> </div> <div class="menu-head-title"> Search Engine Optimization </div> </div> <div class="row"> <div class="col-md-6"> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Content Creation </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> On Page </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Off Page </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Link Building </div> </a> </div> <div class="col-md-6"> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> White Hat </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Black Hat </div> </a> <a href="#" class="menu-items"> <div class="menu-items-icon-a"> <i class="fa fa-arrow-circle-right"></i> </div> <div class="items-title"> Grey Hat </div> </a> </div> </div> </div> </div> </div> </div> </div> </li> </ul> </li> </ul> </div> </div> </div> <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="function.js"></script> </body> </html> |
style.css
Now create a CSS file named ‘style.css‘ and put these codes by copy & pasting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
/** code by webdevtrick ( https://webdevtrick.com ) **/ body { font-family: 'Metrophobic', sans-serif; font-weight: bold; margin-top: 1rem; background: #fff; } #toggle-button { width: 100%; padding: 20px 0; } @media (min-width: 768px) and (max-width: 991px) { .menu-dropdown { margin-top: 4rem; } } @media (max-width: 767px) { .menu-dropdown { margin-top: inherit; } } @media (max-width: 767px) { #toggle-button { display: block; } .nav.nav-pills.pull-right { display: none; } a:first-child { color: #fbb016 !important; } a:first-child:hover { background-color: #222 !important; color: #fbb016 !important; } } @media (min-width: 768px) { #toggle-button { display: none; } .nav.nav-pills.pull-right { display: block; } } .nav { display: block; } .mega-menu { border: 3px solid #333; } .menu-dropdown { left: 0; right: 0; padding: 0; } .inside-menu { position: static !important; } .menu-section { margin-bottom: 30px; } .menu-head { color: #fbb016; border-bottom: 1px solid #ccc; padding: 15px 0; font-size: 20px; } .menu-head:first-child { margin-top: 15px; } .menu-head-icon-1 { height: 35px; float: left; font-size: 40px; margin-right: 10px; } .menu-head-icon-1 i { display: block; } .menu-head-icon-2 { margin-top: 6px; float: right; } .menu-head-title { margin-top: 6px; font-weight: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .menu-items { display: block; font-size: 17px; padding: 15px 0; border-bottom: 1px solid #ccc; color: red; transition: all .3s ease; } .menu-items:link { text-decoration: none; color: #444; } .menu-items:visited { text-decoration: none; color: #444; } .menu-items:hover { text-decoration: none; background: #f2f2f2; color: #444; padding-left: 10px; } .menu-items:active { text-decoration: none; color: #444; } .menu-items-icon-a { float: right; color: #fbb016; } .items-title { font-weight: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } @media (max-width: 767px) { .mega-menu { border: 0; } .menu-section { margin-bottom: 10px; } .menu-head { display: none; } .menu-items-icon-a { display: none; } .items-title { font-size: 14px; padding-left: 15px; } .mega-menu .main-container + * { display: block !important; } .inside-menu { position: relative !important; width: 100%; } .inside-menu .caret { display: none; } .menu-dropdown { display: block !important; position: relative !important; width: 100% !important; border: none !important; box-shadow: none; } } a { color: #333 !important; margin-top: 2px; } a:hover, .nav .open > a, .nav .open > a:focus, .nav .open > a:hover { color: #fbb016 !important; } |
function.js
The final step, Create a JavaScript file named ‘function.js‘ & put the codes.
1 2 3 4 5 6 7 8 9 10 11 |
/** code by webdevtrick ( https://webdevtrick.com ) **/ $(function() { $(document).on('click', '.dropdown-menu', function(e) { e.stopPropagation() }) }) $( "#toggle-button" ).click(function() { $( ".nav.nav-pills.pull-right" ).slideToggle("slow"); }); |
That’s It. Now you have successfully created Bootstrap Mega Menu With CSS Responsive Design. In other words, multiple rows based dropdown & responsive menu using HTML, CSS, JavaScript, & Bootstrap library. If you have any doubt or question comment down below.
Thanks For Visiting, Keep Visiting.
It’s awesome thank you for this.
It’s my duty bro.
Are those codes for blogger or wp
you can use this for blogger of websites also.
shaan bro how can i put background image… and adjust bar at center……you are the great developer