Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove outline in bootstrap 4

I want to remove textbox outline in bootstrap 4 but its not working. How can I remove this line?

enter image description here

CSS

#content #main-content input[type=text]{    border: 0;    border: 1px solid #ccc;    height: 40px;    padding-left: 10px;    outline: 0;  } 

html

<div class="form-group">    <label for="title">Title <span>*</span></label>    <input type="text" class="form-control" id="title" name="title" placeholder="Enter Title"> </div> 
like image 237
Sandeep Avatar asked Jan 28 '18 06:01

Sandeep


People also ask

How do I remove a border in bootstrap?

Use the border-top-0 class to remove the top border from an element.

How do I remove a blue outline in bootstrap?

If you're using Bootstrap 4, add box-shadow: none (and don't forgot the prefix -webkit-box-shadow: none ) to this answer. Also note that Bootstrap 4 already has . btn:focus { outline: none } in its btn classes.


2 Answers

You can add the shadow-none Bootstrap class to remove the focus outline:

<div class="form-label-group">   <input type="password" id="inputPassword" class="form-control shadow-none" placeholder="Password" required>   <label for="inputPassword">Password</label> </div> 
like image 148
John Dibling Avatar answered Sep 16 '22 11:09

John Dibling


The theme you're using sets box-shadow to inset 0 -2px 0 #2196F3 on focus.

You need to override it, but not with none, because that would just remove it. You probably want it to remain at same value like when it's not focused. In short, you need this:

textarea:focus,  textarea.form-control:focus,  input.form-control:focus,  input[type=text]:focus,  input[type=password]:focus,  input[type=email]:focus,  input[type=number]:focus,  [type=text].form-control:focus,  [type=password].form-control:focus,  [type=email].form-control:focus,  [type=tel].form-control:focus,  [contenteditable].form-control:focus {   box-shadow: inset 0 -1px 0 #ddd; } 

Also note you need to load this CSS after Bootstrap CSS and the theme you're loading.

like image 39
tao Avatar answered Sep 16 '22 11:09

tao