Button Dropdown

10 minutes
Share the link to this page
You need to have access to the item to view this lesson.
One-time Fee
List Price:  $139.99
You save:  $40
List Price:  €131.19
You save:  €37.48
List Price:  £112.24
You save:  £32.07
List Price:  CA$192.60
You save:  CA$55.03
List Price:  A$217.25
You save:  A$62.07
List Price:  S$190.37
You save:  S$54.39
List Price:  HK$1,096.25
You save:  HK$313.23
CHF 90.89
List Price:  CHF 127.26
You save:  CHF 36.36
NOK kr1,101.16
List Price:  NOK kr1,541.68
You save:  NOK kr440.51
DKK kr699.21
List Price:  DKK kr978.92
You save:  DKK kr279.71
List Price:  NZ$236.19
You save:  NZ$67.48
List Price:  د.إ514.11
You save:  د.إ146.90
List Price:  ৳15,319.96
You save:  ৳4,377.44
List Price:  ₹11,694.97
You save:  ₹3,341.66
List Price:  RM669.64
You save:  RM191.34
List Price:  ₦181,567.03
You save:  ₦51,880
List Price:  ₨38,857.05
You save:  ₨11,102.81
List Price:  ฿5,147.32
You save:  ฿1,470.77
List Price:  ₺4,550.80
You save:  ₺1,300.32
List Price:  B$732.62
You save:  B$209.33
List Price:  R2,665.20
You save:  R761.54
List Price:  Лв256.41
You save:  Лв73.26
List Price:  ₩192,455.38
You save:  ₩54,991.18
List Price:  ₪530.55
You save:  ₪151.59
List Price:  ₱8,009.48
You save:  ₱2,288.58
List Price:  ¥21,617.62
You save:  ¥6,176.90
List Price:  MX$2,374.63
You save:  MX$678.51
List Price:  QR509.31
You save:  QR145.52
List Price:  P1,929.29
You save:  P551.26
List Price:  KSh18,618.67
You save:  KSh5,320
List Price:  E£6,790.31
You save:  E£1,940.22
List Price:  ብር7,942.45
You save:  ብር2,269.43
List Price:  Kz117,241.62
You save:  Kz33,500
List Price:  CLP$137,040.41
You save:  CLP$39,157.20
List Price:  CN¥1,013.40
You save:  CN¥289.56
List Price:  RD$8,251.22
You save:  RD$2,357.66
List Price:  DA18,826.63
You save:  DA5,379.42
List Price:  FJ$317.87
You save:  FJ$90.82
List Price:  Q1,085.64
You save:  Q310.20
List Price:  GY$29,225.48
You save:  GY$8,350.73
ISK kr14,084.59
List Price:  ISK kr19,718.99
You save:  ISK kr5,634.40
List Price:  DH1,416.82
You save:  DH404.83
List Price:  L2,505.87
You save:  L716.01
List Price:  ден8,074.51
You save:  ден2,307.16
List Price:  MOP$1,125.87
You save:  MOP$321.70
List Price:  N$2,657.05
You save:  N$759.21
List Price:  C$5,137.77
You save:  C$1,468.04
List Price:  रु18,685.75
You save:  रु5,339.16
List Price:  S/525.19
You save:  S/150.06
List Price:  K530.57
You save:  K151.60
List Price:  SAR525.14
You save:  SAR150.05
List Price:  ZK3,528.03
You save:  ZK1,008.08
List Price:  L652.66
You save:  L186.48
List Price:  Kč3,316.71
You save:  Kč947.70
List Price:  Ft51,682.51
You save:  Ft14,767.48
SEK kr1,089.22
List Price:  SEK kr1,524.96
You save:  SEK kr435.73
List Price:  ARS$121,682.87
You save:  ARS$34,769.02
List Price:  Bs966.66
You save:  Bs276.20
List Price:  COP$547,598.77
You save:  COP$156,467.96
List Price:  ₡69,943.14
You save:  ₡19,985.18
List Price:  L3,446.12
You save:  L984.67
List Price:  ₲1,033,044.43
You save:  ₲295,176.63
List Price:  $U5,445.86
You save:  $U1,556.07
List Price:  zł568.23
You save:  zł162.36
Already have an account? Log In


Hello, in this bootstrap four video, we're gonna look at button drop downs. A button drop down is a mixture between a button group and a regular button. Basically you have a button group and within that you have a button which is what you click and then a drop down menu appears. So to actually get started the first thing that we need to do, obviously, these brake lines yet, just so it looks a lot better on the website, but you don't need to do that. So that's the first thing you'll need is a div. And this div is going to be the button group.

We have a separate video on button groups in this series. So check that out to be best if you watch that before watching this video. And within it, we're going to add a button like we had before where that's going to add one particular type of bots installed in a particular way. But you can add an outline button, a small button, whatever type of button you One that's totally up to you. So for the type from the button for the class can be btn btn. Primary like I said you can add whatever type of button you want.

I'm going to keep it simple and add a primary button and you just put a class or drop down dash toggle. Now we need to do data dash toggle. And within this we have to drop down and we need to do area dash has pop up. This is about pop up correctly. equals true for this just allows you to actually pop up area dash x banded equals false. And now what we can just do a close button and just put some text inside the button on the Gonna put, I'm gonna put Click me, exclamation mark.

Now after the button itself, we're gonna add a nother div. And inside this div or portion size, the student needs to have a class of drop down menu. So this is all the menu items that will appear once you click the button, and the drop down menu appears. For this, just put a href equals drop down dash item that is per href. I'm just gonna keep it simple and just put it over the report our website, but you can obviously put whatever you want and put a particular part on your web page, reload the Chrome Web page and send the get variable or just go somewhere else entirely. and install it I'm just gonna put one And that's how you create a basically a drop down menu.

I'm gonna copy and paste this. So got several drop down items, the format is exactly the same. Yes, three should be enough. I'm gonna put two to three. Save that, if we go to our web browser refresh, so we've got our butcher, he got a little ugly, that's called the carrot symbol right there. And if I click that button Now, that's not how it's meant to look.

And let's go back to our code and have a look at what is missing or what has gone wrong. Cuz locsin should look like that. Man. Let's make sure we get everything Correct. Correct. drop down menu, drop down, I turn to the everything looks all good.

Here. Seven look before this. So we got button btn primary Drop down dash, toggle data dash toggle drop down then for the area has popped up, make sure I spelled all of this correctly equals true area dash expanded equals false. So something about this in an oil analysis of an overlook your btn dash group type people got turn on pause do something need to to this up. There we go. I didn't put it as a class a pre HRF you're probably laughing at me thinking what is this guy doing adding two h refs and st class to go back refresh.

This doesn't look different when I click on it. This is how it's meant to look. So we've got two free different menu items. You may have seen in websites that have dropped downs, they have locked a load divider that devoid some of the menu items that's built into bootstrap as well and to add a device a simple A div where you want to divide it to be placed. Make sure you have a class of drop down. void.

Don't need to put any text inside equals empty. And now you can simply just pour in over items arms gonna copy and paste this oopsy Daisy, the wrong keyboard shortcut for copying. And I'm actually gonna just put the text out, doesn't do anything. There you go, we've got our divider, and we got our fourth button, which is after the divider. The reason I just put sign out is because on a lot of websites when you are logged in on sonar learning as well, our education platform, when you go to something like the top right click a drop down is usually like a Profile button. You have something like my profile.

So there's some more info with more pages that are all linked to your profile, and then usually separated and phase thought I thought for you just be pretty cool to show you that what you can also do is a split drop down button. And a split drop down button is very similar, but the button itself and the drop down toggle are separated. So you could have a default click action alternative. Alternatively, he could have a drop down as well. So let's just show you that it's really simple to implement. So what I'm going to do is copy and paste this because it's essentially the same as this.

So all we need to do is add a nother button and this button right here but it's just like we've done button before type of button class equals btn btn primary for this one, let me know that this is all set up for you just save it, it's gonna look slightly dodgy when we click on it. I mean when we refresh, we got essentially two buttons we clicked this on this is just a regular button as part of this drop down, or when we click this one, we have a drop down menu. We don't want this text text it doesn't look very good you can have if you want it, but generally what you want to do is enclose the text inside a span tag, which has the class of s are only which is for screen readers. So that way, the actual drop down itself is empty in terms of text but screen readers have have something to go by when they when they are being used.

So we are regular button and we got our alternative drop down as well. So usually these items will be linked in some way to the original button but they will provide alternative options. So to make your drop down bigger or smaller, all you have to do, we're not actually going to do this for you, we want you to try this out yourself, but simply where you use buttons, add a button size in. So if you just check out the buttons video in this series, we'll see how to do sizing with buttons. Just add the class, and you're all good to go. That's the beauty of this.

It's no different from how you usually would do button in terms of styling and sizing and that sort of stuff. It's just an extension of dice just using buttons and enhancing them. Finally, the last thing we're going to show you is drop up because at the moment, when I click any of these, they drop down, but you may want them to drop off and to do that, you simply add a class to the div that has btn dash group, cord drop up simple refresh And now we have this dropping up, as all you have to do to make your drop down menu be a drop up menu. If you have any questions, feel free to post them on sonar learning Dakota, UK for slash questions dot php. That's our free education platform with thousands of completely free videos, there'll be a link in the description, so you don't need to remember it.

Plus, there'll be another link in the description to the source code from this video and the source code from all the videos in the series. So check that out. Please rate, comment and subscribe. And it'll really help keep the content free. Plus, he also helps us provide more content like this. If you got any requests in terms of video for let us know.

So you can post it on sonar learning or there'll be there'll be an email address in the description as well. So just ask if you want a video and we will help accommodate that. And as usual, thanks for watching and hope you have a great day.

Sign Up


Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.