Better way to create Bootstrap Button



I am struggling to create a bootstrap that houses two different clickable buttons. The notion is simple, but challenging for me for some reason.

here is my CSS:


    float: right;
    height: 25px !important;
    width: 30px !important;
    padding: 2px 1px 2px 2px !important;
    margin-bottom: 0px !important;

    display: block;
    width: 50%;
    letter-spacing: 0.01rem;
    text-align: center;
    text-decoration: none;
    transition: all .16s ease;
    margin: 0 auto;
    background-color: #642F6C;
    line-height: 25px;

Here is my HTML:

<form action="" target="_blank">

        <button class="button_style" >Review PDF <a href="*"><img class="img_style" src="/sites/default/files/download_icon_white.png"/></a></button>


Any suggestions are deeply appreciated.

Also, let me provide an image to make it clear as to what I am trying to accomplish:

I want the button to house to different clickable elements. Can anyone give any actual PRODUCTIVE advice?


Well, the first step in having two clickable buttons is... to put two buttons into your HTML code.


OK - now I'm confused.

Two buttons. Got that.

<form action="" target="_blank">

        <button class="button_style" >Review PDF <a href="*"><img class="img_style" src="/sites/default/files/download_icon_white.png"/></a></button>


But only one button in the code?

And that edit seems to suggest you want one button to do two different (unspecified) things.

Please could you help out a Bear of Very Little Brain and provide some further clarification?


Of course! Thank you for following up with questions about it rather than posting a careless comment.

I have seen buttons on the internet that give you the option to have two separate functions within the same button.

For example, in the image I have above of the button, I want the "Review PDF" part to take the user to a separate page to review the PDF (I've done that successfully in my website). BUT I want the icon to simply download the PDF immeadiately rather than perform the same action. I have tried multiple other options within the HTML, but I can't seperate the two actions without the button element making it look like two different buttons.

Make sense?

Does it have to do with display property like what I've seen discussed here?


No, no drop down menu. Apparently I am not being clear. Please see the button image in my renewed response above for clarity.


You cannot do that with one button. How people usually do is actually with two buttons next to each other without any spacing.


Oh, I didn't know that. I presumed it was all done in one button element.

So something like this?

            <form action="" target="_blank">

                <button class="button_style">Review PDF </button>


                <a href="*"><img class="img_style" src="/sites/default/files/download_icon_white.png"/></a>


If you just want to link to a page or PDF the <a> tag would be a lot easier, but yeah, like that.


No a button only has one action and cannot contain anchors either. Its like trying to put 2 links inside one link:)

Put 2 buttons together (bootstrap has an option for that) and then just add your own personal styling to them.


What class or setup does boostrap use for what your suggesting? Anything would be deeply apprecaited. I'm burning alot of time to perform something so simple. AHHHHH


use a button group?


I tried doing something like a btn group as seen here.

<div class="btn-group">
  <button type="button" class="btn btn-default">Left</button>
  <button type="button" class="btn btn-default">Middle</button>
  <button type="button" class="btn btn-default">Right</button>

The buttons don't line up with each other when I try to use it. Is this a display:block-inline issue?

Wait, I am using Drupal and it's putting <br> in my code without my initiative. The above code works fine now once I remove all spaces in my code. CMS editors really aren't developer friendly sometimes!!


This is a good idea! But I cannot insert JS in my site since it's a CMS (Drupal 7 to be exact).


Does this help :slight_smile:


But how do you make one open a page with the a PDF file shown to you and the icon one, when clicked, download it directly without showing it to you??? I got this:

<div class="btn-group" >
class="btn btn-default button_style comms_page_buttons"> Review PDF 

type="button" class="btn btn-default img_style" 
style="padding: 3.5px;background-color:#411548;">
<img class="img_style" src="/sites/default/files/download_icon_white.png"/>


But right now they both open a new window when I just want one to open a window to show the PDF while the other downloads a file directly. Make sense???


Research the html5 download attribute. It should do what you want in modern browsers.

Or you could turn one file into a zip and that will automatically download.


that's really useful i didn't know that was available. Might have a use for that.

I googled it and found this to explain it



I found a solution that works fine, thanks for all your help!

Dude, this was frustrating finding a solution for something so simple. I learned some important stuff though, here is my code that works fine::

                <div class="btn-group pdf-link" role="group" aria-label="Comms Page Buttons example">
                  <a href="my_PDF" class="btn btn-secondary" >Review PDF</a>
                  <a href="my_PDF" class="btn btn-secondary download" download>&dArr;</a>


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.