Button Dropdown

10 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€94.53
List Price:  €132.34
You save:  €37.81
£78.36
List Price:  £109.71
You save:  £31.34
CA$140.37
List Price:  CA$196.53
You save:  CA$56.15
A$155.59
List Price:  A$217.83
You save:  A$62.24
S$133.98
List Price:  S$187.58
You save:  S$53.59
HK$777.85
List Price:  HK$1,089.03
You save:  HK$311.17
CHF 87.87
List Price:  CHF 123.03
You save:  CHF 35.15
NOK kr1,104.97
List Price:  NOK kr1,547.01
You save:  NOK kr442.03
DKK kr705.03
List Price:  DKK kr987.08
You save:  DKK kr282.04
NZ$170.87
List Price:  NZ$239.22
You save:  NZ$68.35
د.إ367.26
List Price:  د.إ514.17
You save:  د.إ146.91
৳11,912.28
List Price:  ৳16,677.67
You save:  ৳4,765.39
₹8,467.49
List Price:  ₹11,854.83
You save:  ₹3,387.33
RM441.90
List Price:  RM618.68
You save:  RM176.78
₦160,623.93
List Price:  ₦224,879.93
You save:  ₦64,256
₨27,779.72
List Price:  ₨38,892.72
You save:  ₨11,113
฿3,407.07
List Price:  ฿4,770.03
You save:  ฿1,362.96
₺3,476.83
List Price:  ₺4,867.70
You save:  ₺1,390.87
B$605.16
List Price:  B$847.26
You save:  B$242.09
R1,802.94
List Price:  R2,524.18
You save:  R721.24
Лв184.83
List Price:  Лв258.77
You save:  Лв73.94
₩142,008.17
List Price:  ₩198,817.12
You save:  ₩56,808.95
₪359.70
List Price:  ₪503.59
You save:  ₪143.89
₱5,790.19
List Price:  ₱8,106.50
You save:  ₱2,316.31
¥15,056.22
List Price:  ¥21,079.32
You save:  ¥6,023.09
MX$2,023.01
List Price:  MX$2,832.30
You save:  MX$809.28
QR364.03
List Price:  QR509.66
You save:  QR145.63
P1,358.14
List Price:  P1,901.45
You save:  P543.31
KSh12,923.70
List Price:  KSh18,093.70
You save:  KSh5,170
E£4,997.16
List Price:  E£6,996.22
You save:  E£1,999.06
ብር12,483.75
List Price:  ብር17,477.75
You save:  ብር4,994
Kz91,340.86
List Price:  Kz127,880.86
You save:  Kz36,540
CLP$97,077.66
List Price:  CLP$135,912.62
You save:  CLP$38,834.95
CN¥726.33
List Price:  CN¥1,016.90
You save:  CN¥290.56
RD$6,046.17
List Price:  RD$8,464.88
You save:  RD$2,418.71
DA13,322.42
List Price:  DA18,651.92
You save:  DA5,329.50
FJ$227.77
List Price:  FJ$318.89
You save:  FJ$91.12
Q771.77
List Price:  Q1,080.51
You save:  Q308.74
GY$20,855.73
List Price:  GY$29,198.86
You save:  GY$8,343.12
ISK kr13,754.62
List Price:  ISK kr19,257.02
You save:  ISK kr5,502.40
DH992.55
List Price:  DH1,389.61
You save:  DH397.06
L1,833.84
List Price:  L2,567.45
You save:  L733.61
ден5,817.75
List Price:  ден8,145.08
You save:  ден2,327.33
MOP$802.08
List Price:  MOP$1,122.95
You save:  MOP$320.86
N$1,804.81
List Price:  N$2,526.81
You save:  N$722
C$3,672.13
List Price:  C$5,141.13
You save:  C$1,469
रु13,506.11
List Price:  रु18,909.09
You save:  रु5,402.98
S/372.66
List Price:  S/521.74
You save:  S/149.08
K402.76
List Price:  K563.88
You save:  K161.12
SAR375.63
List Price:  SAR525.89
You save:  SAR150.26
ZK2,698.97
List Price:  ZK3,778.67
You save:  ZK1,079.69
L470.50
List Price:  L658.72
You save:  L188.22
Kč2,374.99
List Price:  Kč3,325.08
You save:  Kč950.09
Ft39,084.29
List Price:  Ft54,719.57
You save:  Ft15,635.28
SEK kr1,086.09
List Price:  SEK kr1,520.57
You save:  SEK kr434.48
ARS$101,213.44
List Price:  ARS$141,702.87
You save:  ARS$40,489.42
Bs688.85
List Price:  Bs964.42
You save:  Bs275.56
COP$442,699.46
List Price:  COP$619,796.96
You save:  COP$177,097.49
₡51,468.52
List Price:  ₡72,057.99
You save:  ₡20,589.46
L2,524.11
List Price:  L3,533.85
You save:  L1,009.74
₲779,784.23
List Price:  ₲1,091,729.11
You save:  ₲311,944.88
$U4,330.07
List Price:  $U6,062.28
You save:  $U1,732.20
zł403.35
List Price:  zł564.71
You save:  zł161.35
Already have an account? Log In

Transcript

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

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.