I am using the Bootstrap button, and I want that when I click on them the focus border should not come around the icons. The code is like below.
<div class="btn-group">
<button class="btn btn-link"> <img src="../images/icons/User.svg" class="svg"></button>
</div>
Use this style to avoid the focus border on items
button:focus {
outline: none;
}
Use outline:0; or outline:none; to remove the border on focus
Note: Use !important at the end of the rule to override the Bootstrap declarations
button:focus{
outline:0 !important;
}
or
button:focus{
outline:none !important;
}
Try It Once
button:focus{
outline:0px;
}
Also Use
button:focus{
outline:none !important;
}
I have to edit !important then it work fine.
On Bootstrap 4, "shadow-none" class was added that disables the effect.
Using JQuery you can disable the effect by adding the "shadow-none" class to the relevant buttons.
$(".btn-secondary").addClass("shadow-none");
Its either one or several of the following lines.
button {
outline: none !important;
border: none !important;
box-shadow: none !important;
}
I don't think you will need the :focus part at all as the actual bootstrap button is never showing. I don't at least. And maybe try and leave the !important away in case it works without it.
Add following CSS property if none of them works -
box-shadow:none !important;
If you're using Bootstrap 4 add this class to the input or button tag
shadow-none
All previous answers all incorrect:
Please see below for the reason, I also added snippet at the bottom of my answer
/*incorrect*/
button:focus {
outline:none !important;
}
/*correct*/
.btn.btn-link:focus {
outline:none !important;
}
Please Learn more about CSS Selector about "class"
class ===> using .
id ===> using #
CSS Selectors ( Also About "class")
https://www.w3schools.com/css/css_selectors.asp
"class" Names Concatenated Or Separated By a Space
https://stackoverflow.com/questions/16858926/class-names-concatenated-or-separated-by-a-space
Please check below my example which run in snippet:
/*=============Button1===============*/
.button1 {
width: 50px;
height: 45px;
background-color: #c4891b;
background-image: url('http://order.uprintinvitations.com/photothumbs/089634f1-2a24-485e-81e9-192ac6c8de07.png');
image-rendering: -webkit-optimize-contrast;
background-size: 50px;
background-repeat: no-repeat;
border: none;
transition: transform .5s;
}
/*for changing the colong on mouse over*/
.button1:hover {
background-color: yellow;
transform: scale(1.1);
}
/*for removing the outline*/
.button1:focus {
outline: none;
}
/*=============Button1===============*/
.button2 {
width: 50px;
height: 45px;
background-color: #c4891b;
background-image: url('http://order.uprintinvitations.com/photothumbs/089634f1-2a24-485e-81e9-192ac6c8de07.png');
image-rendering: -webkit-optimize-contrast;
background-size: 50px;
background-repeat: no-repeat;
border: none;
transition: transform .5s;
}
/*for changing the colong on mouse over*/
.button2:hover {
background-color: yellow;
transform: scale(1.1);
}
<table border='1'>
<tr>
<td>
Button 1
<br>(onclick
<br>no outline)
</td>
<td>
Button 2
<br>(onclick
<br>outlined)
</td>
</tr>
<tr>
<td>
<button class='button1' id='' name='' value=''></button>
</td>
<td>
<button class='button2' id='' name='' value=''></button>
</td>
</tr>
<table>
<a href='https://github.com/dicka-ks'>My Github -> Dicka</a>
https://github.com/dicka-ks
It will work
.svg:focus {
border: none;
outline: none;
}
Related
I'm creating a newsletter in Salesforce Pardot and I want the CTA buttons to change color when you hover over them.
I have 2 different CTA buttons.
For the transparent CTA buttons I'm using this CSS and that's working:
.tr1:hover { background: #F7F36D !important; }
.tr1:hover td { background: transparent; }
.tr2:hover { background: #6BCDDD !important; }
.tr2:hover td { background: transparent; }
Etcetera
But I also have a black CTA button where I want to change the bg color (to #E0A9D5) as well as the font color (to #000000). But somehow I can't seem to get it working :(
This is the HTML code:
<tr class="tr6">
<td align="center" class="em_white" height="36" style="height: 36px; background: rgb(0, 0, 0); padding: 0px 12px; font-family: Helvetica, Arial, sans-serif; font-size: 15px; color: rgb(0, 0, 0); border-style:solid; border-radius: 0px; border-width: 2px; border-color: black;" valign="middle">Lorem ipsum dolor »</td>
</tr>
Can anyone help me with the CSS part? Thanks!
In order to use the hover property, you can simply use :hover on any selector. Here is a quick example.
button:hover {
background:yellow;
transform:scale(200%);
}
<button>A button</button>
Now if you want to make another element change when you hover on one element, you can use a code like this:
div:hover ~ span {
background:red;
}
<div id="element1">a div here</div>
<span>span</span>
It's not great practice to have lots of inline style added to your html elements. Therefore, you should strip out the content s of the style="...".
Then instead, choose an appropriate selector, eg the class="em_white" and add style there instead:
.em_white {... Add stripped out style here...}
After that, you can then target the anchor within the tr tag, with something like:
.em_white a {background-color:#f00; color:#000}
.em_white a:hover {background-color:#000; color:#fff}
The added benefit to this is that there is a lot less duplication and also your code will become easier to read. You also only need to make one change to the CSS to effect all elements with that class.
I fixed it by styling both tr6 as em_white. I know this is not the right way to do it, but at least it's working.
.tr6 td { background: #000000; }
.tr6:hover td { background: #E0A9D5; }
.em_white1 a { text-decoration: none; color: #E0A9D5; }
.em_white1:hover a { text-decoration: none; color: #000000; }
How do i remove the blue background when active on an option and hovering on an option with my select dropdown.
Here is a screenshot of what i mean:
I have tried every css rule i could thin off and even search the internet, including here but nothing is working
.language {
float: right;
margin-top: -45px;
padding-right: 25px;
}
.language select {
width: 180px;
border: none;
-webkit-appearance: none;
-moz-appearance: none;
text-indent: 1px;
text-overflow: '';
cursor: pointer;
}
.language select::-ms-expand {
display: none;
}
.language option {
background-color: #000;
color: #fff;
}
.language option:hover {
background-color: #000;
color: #fff;
}
.language-selector::before {
font-family: "Font Awesome 5 Free";
content: "\f0ac";
visibility: visible;
font-weight: 900;
position: relative;
float: left;
margin-left: 1690px;
margin-top: -53px;
}
<div class="language">
<select>
<option value="">English</option>
<option value="">Deutsch</option>
</select>
</div>
Well, you can't. This is set by the OS. Sorry :/
Try this
:focus {outline:0 !important;}
and this
:hover {outline:0 !important;}
If this is not working try on ur own css style !importent this will overwrite all the normall css
Good luck :)
Usually you'd use background: transparent but you have to tell us the rule that's setting the blue color or if it's the OS/browser as someone else mentioned, tell us which OS/browser. Dropdown attributes can't always be styled as many are set by the browser (see the diff between them in Firefox and Chrome). The solution for complete style control is unfortunately to create your own dropdowns using a trigger and list of items you toggle visibility and handle the user's selection.
hi It's happend for me and this is mt solution {background: transparent !important;}
html
(input type button disabled), on IPhone devices it's grey!
but I want it stay in the same style when it's disabled...
how to do that?
I tried use “-webkit-appearance: none;”
all (input type button) changed to my css,
but the disabled buttons is still grey...
even if I write "input:disabled{background-color:white}"
<style>
input{
display: block;
-webkit-appearance: none;
margin:5px;
border: 2px solid #000;
background-color: white;
}
input:disabled{
display: block;
border: 2px solid #000;
webkit-appearance: none;
background-color: white;
}
</style>
<body>
<input id="button1" type="button" disabled>
</body>
I want IPhone use the style I write...
on IPhone,https://imgur.com/a/OkTjzoa
on PC/Android,https://imgur.com/1miAJtZ
Problem solved!!
just set opacity to 1
input:disabled {
-webkit-appearance: none;
opacity:1;
}
You're just trying to get the disabled button to stay white? It might help for you to use the following string:
input:-webkit-autofill {
background-color: white !important;
}
The important tag will force the background to be white.
I have a button . When I click on it, some weird dotted lines show up like this which I cannot remove. Tried everything I know in CSS but cannot fix. Please Help.
Here is my css:
input.filterIcon {
width: 32px !important;
height: 32px !important;
background: url(../images/filter-icn.png) no-repeat center right !important;
padding: 0px !important;
cursor: pointer;
float: right;
vertical-align: middle;
margin: 0 0 0 10px !important;
font-size: 12px;
letter-spacing: 0.5px;
position: fixed;
z-index: 99999;
top: 70px;
right: 15px;
outline: 0 !important;
}
Here is my html
<form id="search_form">
<input type="button" class="filterIcon" id="iconfilter">
</form>
Anchor links ('s) by default have a dotted outline around them when they become "active" or "focused".
If you want it gone, and you want it gone on every single anchor link, just include this as a part of your CSS reset:
a, button {
outline: 0;
}
a:hover, a:active, a:focus {
/* styling for any way a link is about to be used */
}
Firefox Inputs Clicking down on an input type=image can produce a dotted outline
To remove it: input::-moz-focus-inner { border: 0; }
Source : https://css-tricks.com/removing-the-dotted-outline/
Difficult to determine without any additional info but try adding this to the button’s css
outline: 0;
Its because of outline, you can try this code.
button, button:hover, button:focus, button:active,
a, a:hover, a:focus, a:active {
outline: 0;
}
The dotted border is there for accessibility reasons as a visual clue of what has been selected (clicked on). You can get rid of this easily by adding this CSS to the elements (class name depends on the element):
.button {
outline: none;
}
outline on the Mozilla Developer Network:
The outline CSS property is a shorthand for setting various outline properties in a single declaration: outline-style, outline-width, and outline-color.
You can remove the outline with this code:
outline: none;
How to remove default border of button in jquery mobile?
I declare the <a> tag as a button, with custom background images as below:
<a id="btnLogin" href="../main/mainx.html" data-role="button" data-corner="false"> Login</a>
<a id="btnSignUp" href="../singup/signup.html" data-role="button" data-corner="false"> Sign Up</a>
CSS:
a{
width: 265px;
height: 38px;
margin-left: auto;
margin-right: auto;
margin-top: 5px;
border: 0px;
border-color: transparent;
display: box;
text-transform: none;
text-shadow: none;
}
#loginPage a .ui-btn-inner{
padding-top: 11px;
}
#loginPage #btnLogin{
background: transparent url(../../res/img/login_btn.png) no-repeat;
background-size: 100% 100%;
color: #FFF;
}
#loginPage #btnLogin:hover{
background: transparent url(../../res/img/login_btn_over.png) no-repeat;
background-size: 100% 100%;
}
#loginPage #btnSignUp{
background: transparent url(../../res/img/signup_btn.png) no-repeat;
background-size: 100% 100%;
color: grey;
}
#loginPage #btnSignUp:hover{
background: transparent url(../../res/img/signup_btn_over.png) no-repeat;
background-size: 100% 100%;
color: #fff;
}
The button shows within blur border like this:
Please help me.
I think that you're looking for the outline property :
a {
outline:0;
}
To override default styles for buttons in jQuery Mobile, do your modifications on class .ui-btn followed by !important for each property.
Demo: http://fiddle.jshell.net/Palestinian/8TH5d/
.ui-btn { border: none !important; }
As for the shadow, add this attribute data-shadow="false" to <a> tag.
Changing to use button element, everything works fine.
<button id="btnLogin" href="../main/mainx.html" data-role="none" data-corner="false"> Login</button>
<button id="btnSignUp" href="../singup/signup.html" data-role="none" data-corner="false"> Sign Up</button>`
Can you check the background image of button? it maybe contain border inside
IMO best way to have back buttons is to do this
$(document).on("mobileinit", function () {
$.mobile.toolbar.prototype.options.addBackBtn = true;
$.fn.buttonMarkup.defaults.corners = false;
});
However, $.fn.buttonMarkup.defaults.corners = false; doesnt remove round corners for back buttons that are automatically generated using the global options.
This solution worked fine for me
border: none !important;
box-shadow: none !important;
outline: 0;