How to remove blue outline of select option in Twitter Bootstrap - css

I am working on this example and am seeking how to get rid of that blue outline for drop-down select button and the Search inbox inside the drop down menu. See this image:
I already tried:
.btn-default {
outline: none !important;
box-shadow: none !important;
background-color: transparent !important;
background-image: none !important;
}
input, textarea, select, a { outline: none !important; }
input:focus, textarea:focus, select:focus{ outline: none; }
but they are not doing the trick.

Bootstrap form input elements do not use the outline property, but rather recreate it using box-shadow. You were on the right track with what you were doing, but the style that causes this is the following:
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
}
You will want to override those styles with your own, setting the box-shadow to none and adjusting the border-color to match your default.
As for the select box, you can use the following style, as was originally mentioned by #kamlesh-kushwaha, to override the bootstrap setting:
.bootstrap-select .btn:focus {
outline: none !important;
}

For <select> dropdown, change in bootstrap-select.min line 29:
.bootstrap-select .dropdown-toggle:focus {
outline: thin dotted #333 !important;
outline: 5px auto -webkit-focus-ring-color !important;
outline-offset: -2px;}
to:
.bootstrap-select .dropdown-toggle:focus {
outline: none!important;
}

I remove bootstrap 4 dropdown-toggle 'on click' blue borders by doing this:
.yourdivname:focus {
box-shadow: none;
}
Anything else seemed to be irrelevant. For instance, with normal buttons {outline: none} always seemed to work, but not for this element. All that was needed was the box-shadow:none property.

Add the css focus rule or modify the existing one.
.bootstrap-select .btn:focus{outline:none!important;}
Similarly, you can add for select

You can use input[type] {}
All bootstrap input type as below
textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="datetime"]:focus,
input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
input[type="time"]:focus,
input[type="week"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="color"]:focus,
.uneditable-input:focus {
border-color: rgba(126, 239, 104, 0.8);
/* give your style */
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1) inset, 0 0 8px rgba(255, 0, 0, 0.6);
/* give your style */
outline: 0 none;
/* give your style */
}
select:focus {
outline-color: transparent;
}

Bootstrap or not, you can remove the the outline from a select tag with with:
select:focus {
box-shadow: none;
}

Related

Can't omit outline with combo box

I've just started to work with SAPUI5, and I'm having some trouble regarding combo boxes.
When I open the new window I created, it starts focusing the combo box, but with an annoying dotted outline. It only disappears if I click outside the combo box, but I really need it to not show at all, not even when I click inside.
I have tried several libs and classes, but none of these gave me the desired output.
Below are the classes I tried:
.comboCreateDoc {
border-left: none;
border-right: none;
border-top: none;
outline: 0px transparent !important;
outline-style: none !important;
}
html.sap-desktop .comboCreateDoc .sapMInputBaseContentWrapper {
border: none !important;
background: transparent !important;
outline-style: none !important;
outline: 0px dotted transparent !important;
outline-offset: -3px;
}
html.sap-desktop .sapMBtn:focus > .sapMFocusable {
outline: 0px dotted transparent !important;
outline-offset: -3px;
}
html.sap-desktop .sapMCbBgs:active > .sapMFocusable {
outline: 0px dotted transparent !important;
outline-offset: -3px;
}
.sapMInputBaseIconContainer{
outline: none !important;
}
.sapMComboBoxInner .sapMInputBaseInner{
outline: none !important;
}
html.sap-desktop .sapUiBody:focus {
outline: non !important;
}
How can I make the dotted outline disappear?
I dig into their samples to find the combo box and I saw that they don't use the native browser focus.
They put a class .sapMFocus that gives that dotted border to the element.
You need to override that class styles like that:
.sapMFocus .sapMInputBaseContentWrapper::before {
border:none;
}

Couldn't change the border color for each item on main menu

I have set CSS for each button on main menu. I want to change the border color for each item.
I can change the color what ever I want. But I want to pick out some specific color for each button.
This part of CSS define the border color:
#main-nav .menu-sub-content {
display: none;
padding: 0;
position: absolute;
z-index: 205;
border-top: 12px solid ;/*#F88C00*/
border-top-color: transparent !important; /*I change to transparent*/
background: #fff;/*2d2d2d*/
color:#999;
-webkit-box-shadow: 0 3px 4px 1px rgba(0, 0, 0, 0.2);
box-shadow: 0 3px 4px 1px rgba(0, 0, 0, 0.2);
-webkit-border-bottom-right-radius: 3px;
-webkit-border-bottom-left-radius : 3px;
-moz-border-radius-bottomright : 3px;
-moz-border-radius-bottomleft : 3px;
border-bottom-right-radius: 3px;
border-bottom-left-radius : 3px;
}
First I tried this
border-top-color: transparent !important;
And then I put this CSS for 3rd button
.ucuncu-nav.menu-sub-content{
/*border-top:12px solid;*/
border-top-color:#669900 !important;
}
But it didn't changed. How can I change it now?
Elements of your list have id's which you can use when adding separate borders for what you display on hover. Try this code:
#menu-item-17:hover .mega-menu-block {
border-top: 3px solid red !important;
}
#menu-item-7:hover .mega-menu-block {
border-top: 3px solid green !important;
}
etc, for all your <li> menu items with different id's. !important rule is here a quick solution because the is overridden for some default styles.

How to remove the blue highlight of button on mobile?

I try to remove the blue box that appears on click in front of buttons as you can see below:
Before asking, I have made a lot of research, I have tried the solutions given by the following topics:
How to remove focus border (outline) around text/input boxes? (Chrome)
Remove blue box around buttons. HTML
How to remove the blue box shadow border in button if clicked
How do I remove blue "selected" outline on buttons?
How do I remove blue "selected" outline on buttons?
Remove blue border from css custom-styled button in Chrome
How to remove focus around buttons on click
I have tried all the answers! It works on computer but not on mobile.
If you are using a computer, you can try by simulating mobile with the inspector. Here is the button: https://jsfiddle.net/t4ykshst/
#add {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
outline: none;
cursor: pointer;
padding: 10px;
overflow: hidden;
border: none;
-webkit-border-radius: 50%;
border-radius: 50%;
color: rgba(255, 255, 255, 0.9);
text-align: center;
background: #1abc9c;
-webkit-box-shadow: 0 4px 3px 2px rgba(0, 0, 0, 0.2);
box-shadow: 0 4px 3px 2px rgba(0, 0, 0, 0.2);
}
#add:active {
opacity: 0.85;
-webkit-box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.2);
box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.2);
}
<input type="button" id="add" value="+" title="" style="position: absolute; left: 0px; top: 0px; width: 52px; height: 52px;" />
You can add:
-webkit-tap-highlight-color: transparent;
You can also add this to your stylesheets to define it globally:
input,
textarea,
button,
select,
a {
-webkit-tap-highlight-color: transparent;
}
Refer to here for more information.
* {
-webkit-tap-highlight-color: transparent;
}
Test it.
You just need to add
style="-webkit-tap-highlight-color: transparent;"
There will be no highlighting (at least in Chrome 88+) at all if you remove cursor: pointer from #add selector. And if you need it in the "desktop" mode, use something like this:
#media (min-width: 768px) {
#add {
cursor: pointer;
}
}
-webkit-tap-highlight-color is a non-standard feature (mdn). It won't work in browser like safari 14.
Instead, you can use
{ outline: none; }
or apply it specifically through selector
a:focus,a:visited,a:active{
outline: none;
}
Try it
add to the button style "cursor: default;"
This will make a cursor:pointer; it turns into a "default", but will remove the blue shadow on the buttons on the mobile screen as you want
In addition to all the answers here, you have to also specify the background css property explicitly yourself to the button.

How to get rid of the input glow in Bootstrap SASS with Chrome/Firefox?

I am trying to extend Bootstrap. I do not want to touch any of the Bootstrap core files, so I have created my own styles.scss and in there I have the following:
#import "custom/variables";
#import "../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
#import "custom/modular-styles";
In _variables.scss I am overwriting some of the variables (e.g. getting rid of rounded corners).
In _modular-styles.scss I call various other SASS partials that I want to customise (e.g. _forms.scss).
In _forms.scss here is what I've done:
.form-control {
display: block;
width: 100%;
height: $input-height-base;
padding: $padding-base-vertical $padding-base-horizontal;
font-size: $font-size-base;
line-height: $line-height-base;
color: $input-color;
background-color: $input-bg;
background-image: none;
border: 1px solid $input-border;
border-radius: $input-border-radius;
box-shadow: none; // this use to be #include box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
#include transition(border-color ease-in-out .15s, box-shadow ease-in-out .15s);
outline: none; // this use to be #include form-control-focus;
#include placeholder;
&::-ms-expand {
border: 0;
background-color: transparent;
}
&:focus {
outline: none;
}
&[disabled],
&[readonly],
fieldset[disabled] & {
background-color: $input-bg-disabled;
opacity: 1;
}
&[disabled],
fieldset[disabled] & {
cursor: $cursor-disabled;
}
}
Shouldn't that work? Yet I am still seeing the outline glow when an input is on :focus
The glow on focus in Bootstrap is given by a box-shadow on :focus, like this:
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
}
If you want to modify your focus styles add sth like this:
.form-control {
&:focus {
box-shadow: none;
/* your new styles */
}
}
You can do it by overriding the sass variables:
$input-box-shadow: none;
$input-focus-box-shadow: none;
$input-btn-focus-box-shadow: none;
And in case that doesn't do the trick (I've seen some weird behaviors with files ordering):
.form-control {
&:focus {
box-shadow: none !important;
}
}
Just a hint, but make sure you've imported Bootstrap only once. Once I had forgotten to remove it from my angular.json (former angular-cli.json) and that caused conflicts.
From what I recall, you need to override the outline in the :focus pseudo class, not just the main css class
.form-control {
...
&:focus {
outline: none;
}
}
See: How to remove the border highlight on an input text element
Try adding the following CSS:
textarea:hover,
input:hover,
textarea:active,
input:active,
textarea:focus,
input:focus,
button:focus,
button:active,
button:hover,
label:focus,
.btn:active,
.btn.active
{
outline: none !important;
border: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
}
Try adding the following css
.form-control:focus {
box-shadow: none;
}
Explanation: In Bootstrap, the value of box-shadow changed when the input tag is focused, so the transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out worked.
Hope it helps.

Unwanted borders in unordered list menu

I'm trying to figure out where the border on the horizontal menu items comes (based on a unordered list): http://developers.ttsistemi.com/clive/
I've tried everything.
I've even tried to set the border (and just in case the background, padding and margin) to none/transparent/0, to main element and it children, but I still get this annoying border (you can barely see it, but is there, between all menu items).
The site is in WordPress and uses a Required+ child theme (based on Zurb's Foundation).
I've spend something like 4 hours trying to find where this border comes from (inspecting the CSS with Chrome's developer tools) but I'm stuck. I just don't see any border setting leftover: everything that might have been set by the parent theme should be everything overridden by now.
1) For .navbar > li delete these properties that are currently set:
.navbar > li {
box-shadow: 1px 0 0 rgba(255, 255, 255, 0.2) inset; /* Delete */
border-width: 1px medium 1px 1px; /* Delete */
border-style: solid none solid solid; /* Delete */
border-color: #333333 -moz-use-text-color #333333 #333333; /* Delete */
2) Because your last <li> is selected using the :last-child pseudo-selector you must change it separately or else you'll have a border on the last menu-item. So remove:
.navbar > li:last-child {
border-right: 1px solid #333333; /* Delete */
box-shadow: 1px 0 0 rgba(255, 255, 255, 0.2) inset,
1px 0 0 rgba(255, 255, 255, 0.2); /* Delete */
Here is the screenshot showing the missing borders/box-shadow
http://img38.imageshack.us/img38/5845/menu2b.jpg
I have take a look and just don't know what border do you want to remove, maybe the border in the menu, I found it here:
.home #container #content-wrapper #access {
font-family: 'Museo Slab';
width: 100%;
border-top: 1px solid black;
border-bottom: 1px solid black;
background-color: rgba(236, 236, 236, 0.5);
margin: 0;
padding: 0;
text-align: center;
}
in app.css line 101, remove this border it won't display anymore.
In Dark's answer, I checked it too:
I think the width of nav id="access" is incorrect, it should change like this:
.eight, .row .eight {
width: 38.66667%;
}
I saw your background-image on footer make the text hard to look, I recommend you should remove it or add a space for them.

Resources