4

I am using Drupal 7 and I would like to render a link (anchor tag) the same as a submit button. Does Drupal 7 allow for this (say by using the button type) or do I have to use CSS to accomplish this?

2
  • 2
    No need to add CSS, just add a class "button" in your link.
    – Inizio
    Jul 12, 2013 at 6:37
  • This worked great! I didn't know that you could do that. Thanks.
    – user5013
    Jul 12, 2013 at 15:54

3 Answers 3

2

You need to, and should, use CSS to style this.

.buttonize {
  -webkit-appearance: button;
  -moz-appearance: button;
  appearance: button;
  padding: .5em;
  /* whatever other styles you want */
}

I added a jsfiddle.

You can look this up, but I'll note that appearance is different on OS's

1
  • Thanks this is good to know. I didn't realize there was an appearance css tag.
    – user5013
    Jul 12, 2013 at 15:54
0

If you are using bootstrap, add 'btn' class to anchor tag. So simple!

0

If you are using a Drupal default theme, you can try these classes:

Add button

button button-action button--primary button--small

Save button

button button--primary js-form-submit form-submit

Form submit button

button js-form-submit form-submit

You can use an element inspector on other admin pages to see what button classes can work for you, but these cover the most common cases for Bartik and Seven in D8. For Bootstrap, go with Sujith's answer about the btn classes. Here are the relevant links:

https://getbootstrap.com/docs/3.3/css/#buttons

https://getbootstrap.com/docs/4.1/components/buttons/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.