Issue with applying Bootstrap button style to buttons

I have been attempting to customize these buttons using my CSS, but unfortunately, they are not reflecting the desired style.

Even after creating new buttons, I encountered the same issue where they did not adhere to the CSS. Upon closer inspection, I noticed that the text was being automatically transformed into uppercase, a feature included in my CSS. This observation makes me question if there is an error somewhere in the code.

 <section id="gallery" class="content-section text-center">
      <div class="container">
      <div class="row">
      <div class="col-lg-8 mx-auto">
        <button class="btn active" onclick="filterSelection('all')">Show all</button>
        <button type="button" onclick="filterSelection('sealion')">Sea Lions</button>
      </div>

.btn {
  font-family: 'Cabin', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
  -webkit-transition: all 0.3s ease-in-out;
  -moz-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
  text-transform: uppercase;
  border-radius: 0;
}

.btn-default {
  color: #42DCA3;
  border: 1px solid #42DCA3;
  background-color: transparent;
}

.btn-default:focus, .btn-default:hover {
  color: black;
  border: 1px solid #42DCA3;
  outline: none;
  background-color: #42DCA3;
}

The end goal is for the buttons to be presented as black rectangles with white text and a green border. When a button is hovered over, it should change to a solid green color.

Answer №1

Insert the btn-default class into the button element.

<section id="gallery" class="content-section text-center">
      <div class="container">
      <div class="row">
      <div class="col-lg-8 mx-auto">
        <button class="btn btn-default active" onclick="filterSelection('all')">Show all</button>
        <button type="button" onclick="filterSelection('sealion')">Sea Lions</button>

      </div>

https://jsfiddle.net/lalji1051/puezgn9v/4/

Answer №2

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<style type="text/css">
.btn {
  font-family: 'Cabin', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
  -webkit-transition: all 0.3s ease-in-out;
  -moz-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
  text-transform: uppercase;
  border-radius: 0;
}

.btn.active.btn-default {
  color: #42DCA3;
  border: 1px solid #42DCA3;
  background-color: transparent;
}

.btn.active.btn-default:focus, .btn.active.btn-default:hover {
  color: black;
  border: 1px solid #42DCA3;
  outline: none;
  background-color: #42DCA3;
}
.btn.active.btn-primary {
  color: #42DCA3;
  border: 1px solid #42DCA3;
  background-color: transparent;
}

.btn.active.btn-primary:focus, .btn.active.btn-primary:hover {
  color: black;
  border: 1px solid #42DCA3;
  outline: none;
  background-color: #42DCA3;
}
</style>

<section id="gallery" class="content-section text-center">
   <div class="container">
      <div class="row">
        <div class="col-lg-8 mx-auto">
          <button class="btn active btn-default" onclick="filterSelection('all')">Show all</button>
          <button class="btn btn-primary active" onclick="filterSelection('sealion')">Sea Lions</button>
        </div>
      </div>
   </div>
</section>

give this code a try, it should be functional now

Answer №3

To customize the appearance of your buttons, start by adding the class btn-default to your button element. Then, you can apply CSS styles using all the classes of the button together, like .btn.active.btn-default, in order to override the default Bootstrap styles.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Are there any available polyfills for downloading links using data URIs?

My issue involves generating code from the server: <a download="test.csv" href="data:text/plain;charset=utf-8;base64,w4FydsOtenTFsXLFkXTDvGvDtnJmw7p0w7Nnw6lwLg=="> teszt </a> This solution currently works with Chrome, Firefox, and Opera. ...

Tooltip Bootstrap timing

I am currently working on creating a navigation bar with icon-only buttons that display tooltips when touched or tapped. Here is the code I have implemented: $('a[rel="tooltip"]').tooltip({ animated: 'fade', placement: ' ...

Struggling with implementing ng-repeat in AngularJS for displaying HTML content

I stumbled upon a post that covers pretty much what I'm trying to achieve: AngularJS - Is it possible to use ng-repeat to render HTML values? Currently, the code appears like this and displays correctly as text: <div ng-repeat="item in items.Item ...

Javascript is malfunctioning when trying to import Bootstrap library

I've been attempting to integrate this search bar into my webpage from the following source: https://github.com/jeffersonRibeiro/jquery-simpleSelect However, it seems to encounter issues when I import bootstrap. I've double-checked the import pr ...

What is the best way to analyze this header information?

In the multipart header that I have, it begins with ------------------123456\r\n The number 123456 is a GUID that I need to extract. I have been trying to understand how this header is constructed by looking at the specifications, but it seems ...

What is the best way to expand a scrollbar's width with CSS?

Can the width of a scrollbar on a <div> element within the <body> be increased? I mean the scrollbar specifically on the inner <div> element, not the default browser scrollbar since this page is in full screen mode and does not display t ...

Use the toggle function in pure JavaScript to apply it only to the element that has been clicked

In this HTML code snippet, I am displaying data in a list format with nested subcategories. Each category is displayed as a clickable parent menu item. When clicked, the corresponding subcategories should be toggled to show or hide. <ul id="menu"&g ...

Reduce multiple paragraphs in PHP to a more concise form

Is there a way to trim paragraph content to 100 characters, especially when dealing with multiple paragraphs? For example, consider the following HTML snippet: <div class="div-1"> <div class="section-1"> <p>"Lorem ipsum ...

Reset the change function after the click function has been executed

I am currently using the change event handler for my input elements and then prompting users with questions. All of my code resides within a click function. I would like to allow users to answer the questions again, without retaining their previous data. S ...

Creating a DIV with vertical scroll-bars exclusively for lengthy paragraphs in HTML: What's the best approach?

I need to display terms and conditions on my website without using a text field or taking up the entire page. Instead, I want to show the text in a specific area with only a vertical scroll bar for users to navigate through the content. Here is the curren ...

Range slider position not being updated after user interaction

I am working on a webpage with an embedded video and a range slider that serves as a progress bar. Using Javascript, I update the value of the range slider as the video plays, allowing users to navigate through the video content. However, I have encounter ...

The parameter type 'Event' cannot be assigned to the argument type

edit-category-component.html: <custom-form-category *ngIf="model" [model]="model" (onSaveChanges)="handleChanges($event)"></custom-form-category> <mat-loader *ngIf="!model"></mat-loader> edi ...

Bizarre discrepancies in text wrapping across various browsers

After encountering a larger issue, I found that I could reduce it to a simpler scenario: To see the problem in action, check out this jsFiddle link: http://jsfiddle.net/uUGp6/ Here is the simplified HTML code: <div class="box"> <img class=" ...

CSS Tutorial: Creating a Dynamic Gradient Bar

I am looking to create a dynamic colored bar with a moving color gradient effect. Without using JavaScript, I want to achieve this effect using CSS 3 properties such as gradients and animations. This is a snippet of what I have tried so far: HTML: <b ...

Tips on embedding an HTML page within another HTML page by utilizing a custom directive in AngularJS

I am looking to utilize custom directives in order to insert one HTML page into another. How can I achieve this? The custom directive code is as follows: (here is the .js file) fbModule.directive('fbLogin', function(){ return { ...

Tips for choosing the dropdown selection on an ASPX website page

I have a specific dropdown menu set up, and I need to select the appropriate option from the viewdata object in my .aspx page. Here is what my menu looks like: <td headers="Vehicle" style="background-color:#EFF3FB;font-family: Verdana; font-size: 10px ...

"Angular Ionic combination for displaying lists with customized headers and footers on cards

My issue is fairly straightforward - I am looking to create a list card with item array from my controller. However, I am struggling with how to structure my data in the HTML. The list card should have a header, content, and footer. I have attempted variou ...

Is your Bootstrap input displaying the has-error class with a glyphicon, but the alignment is not vertically centered?

What is the reason for the misalignment of glyphicon-warning-sign form-control-feedback vertically in the code below after applying font-size: 20px; to the label? <div class="container"> <div class="content align-left contact"> ...

Is it possible to overlay two divs on top of a current website layout?

I am currently attempting to overlay two divs on top of an established website, similar to the layout shown in the image: While I am able to achieve this successfully in browsers like Firefox and Google Chrome, I am encountering difficulties when trying t ...

Multiple Ajax(Jquery method) Submissions with just one click and issue with Image not being sent to the server

Having trouble submitting form data to the server after client-side validation using jQuery. I've been working on this all day and could really use some help. I created a jQuery slider for my login form, where it slides to the next input field after v ...