-2

I tried,

<input type="button" class="btn btn-primary">

I want this style in custom.css

2 Answers2

1

this style is for .btn class in bootstrap:

  .btn {
  display: inline-block;
  font-weight: 400;
  color: #212529;
  text-align: center;
  vertical-align: middle;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 0.25rem;
  transition: color 0.15s ease-in-out,
  background-color 0.15s ease-in-out,
  border-color 0.15s ease-in-out,
  box-shadow 0.15s ease-in-out;
}
.btn:hover {
  color: #212529;
  text-decoration: none;
}

and this is for .btn-primary:

.btn-primary {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}
.btn-primary:hover {
  color: #fff;
  background-color: #0069d9;
  border-color: #0062cc;
}
.btn-primary:focus {
  box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5);
}
.btn-primary:not(:disabled):not(.disabled):active {
  color: #fff;
  background-color: #0062cc;
  border-color: #005cbf;
}
.btn-primary:not(:disabled):not(.disabled):active:focuss {
  box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5);
}

and this is for input type="button" and input element:

[type="button"]:not(:disabled),
button:not(:disabled) {
  cursor: pointer;
}

[type="button"] button {
  -webkit-appearance: button;
}
input {
  margin: 0;
  font-family: inherit;
}

this button is exactly like bootstrap button even if you don't use Bootstrap.

Hami
  • 11
  • 5
0

If u want to copy content of bootstrap css class to your file and fire it from your file , download bootstrap files (find inside class u want , here is btn and btn-primary) and copy these classes to you file , and u can use it without linking to bootstrap files. U may also override bootstrap classes , it is up in what order u will link css files in your

better way and I think more moral ;) is to write own btn btn-primary class using bootstrap modifier tool https://getbootstrap.com/docs/3.4/customize/

oleevier
  • 154
  • 7
  • I used btn btn-primary but when i apply my own css style it will change primary property – siddharth007 Oct 17 '19 at 11:26
  • in CSS order of occurrence is important , u can easy override primary property – oleevier Oct 17 '19 at 11:29
  • how to override bootstrap classes in custom.css file – siddharth007 Oct 17 '19 at 11:30
  • to override bootstrap classes , link to your css file in must be lower in code than link to bootstrap css file , and then if you use same names as bootstrap u can override it , i use it sometimes to change colors :) this may explain with examples : https://stackoverflow.com/questions/20721248/how-can-i-override-bootstrap-css-styles – oleevier Oct 17 '19 at 11:32
  • can you any example, for more clarrity – siddharth007 Oct 17 '19 at 11:37
  • https://stackoverflow.com/questions/20721248/how-can-i-override-bootstrap-css-styles – oleevier Oct 17 '19 at 11:38