I'm trying to create an application in Electron (version 1.6.2). Within the app I have a number of elements that I want to behave like buttons but display as simple Glyphicons. I use the following React code:
private static optionsFormatter () {
return (
<div className={`${styles.fieldGlyphiconContainer}`}>
<Button className={`${styles.glyphiconButton} btn-link`}><Glyphicon glyph='edit'/></Button>
<Button className={`${styles.glyphiconButton} btn-link`}><Glyphicon glyph='remove'/></Button>
</div>
);
}
In their default state, these elements render fine:
However, when I focus one of these elements an orange outline appears around it, which I don't want:
Looking through the CSS rules in the Electron debugger, it looks like the culprit is this from the Bootstrap CSS file:
.btn:focus, .btn:active:focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn.active.focus {
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
However, I'm not able to suppress these rules. Based on answers to similar questions such as this and this, I've tried adding the following rules to my CSS files:
.glyphicon-button {
// ...
:focus,
:active:focus,
.active:focus,
.focus,
:active.focus,
.active.focus {
outline: none !important;
}
}
.btn:focus,
.btn:active:focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn.active.focus {
outline: none !important;
}
I've also tried disabling the rules in the Electron debugger. However, none of this has worked:
Is there any way I can get rid of the orange outline on focus?
Edit
Based on #ovokuro's comment, I've changed my CSS to this:
.glyphicon-button {
padding: 0;
color: black;
:focus,
:active:focus,
.active:focus,
.focus,
:active.focus,
.active.focus {
outline: none !important;
}
}
button:focus,
button:active:focus,
button.active:focus,
button.focus,
button:active.focus,
button.active.focus {
outline: none !important;
}
This seems to work, although it globally modifies the button focus style. The next step is just to make this only apply to '.glyphicon-button'-class buttons.
Edit 2
Tried the following but this doesn't work:
button.glyphicon-button {
button:focus,
button:active:focus,
button.active:focus,
button.focus,
button:active.focus,
button.active.focus {
outline: none !important;
}
}
Target the HTML button element with class glyphicon-button when focussed like so:
button.glyphicon-button:focus,
button.glyphicon-button:active:focus,
button.glyphicon-button.active:focus,
button.glyphicon-button.focus,
button.glyphicon-button:active.focus,
button.glyphicon-button.active.focus {
outline: none !important;
}
Be aware that removing the outline property has consquences on accessibility.
Related
I've been digging through the Ant-Design node_module trying to change the default color and default width of an active tab but have had no luck. Anyone know how to override it?
The problem is that I don't know which element has the border to begin with. Any help is very welcomed.
you can go with:
.ant-tabs-tab.ant-tabs-tab-active {
border-bottom: 2px solid #BF2D30 !important;
z-index: 2;
}
UPDATE
This style will do as expected.
.ant-tabs-ink-bar {
height: 5px;
background: red !important;
}
Check https://pro.ant.design/docs/style#Override-the-component-style on how to override style .
Refer dis answer too Antd: How to override style of a single instance of a component
To figure out on what needs to be changed on your own, Inspect the element in browser.
You need use tabBarStyle props.
See docs: https://ant.design/components/tabs/
I solve this problem with this code:
import './styles.less';
const [tabIndex, setTabIndex] = useState('0');
const borderClass = ['redBorder', 'greenBorder', 'blueGreyBorder'];
<Tabs
className={`tabs ${borderClass[tabIndex]}`}
defaultActiveKey={tabIndex}
onChange={onSetTabIndex}
>
// And in the styles.less:
` .tabs {
margin-top: 17px;
width: 100%;
}
.redBorder{
.ant-tabs-ink-bar {
background-color: #e94747;
}
}
.greenBorder{
.ant-tabs-ink-bar {
background-color: #24ad52;
}
}
.blueGreyBorder{
.ant-tabs-ink-bar {
background-color: #5b708b;
}
}`
with the state we can change the class and use the cascade css to solve our problem
I'm trying to create custom theme css for Primefaces 6.1, on the select one menu trigger I'm trying to change the bajcground color of the trigger when it's hovered and focused. Here's what I've tried
.ui-selectonemenu .ui-selectonemenu-trigger
{
background-color: blue;
}
.ui-selectonemenu .ui-selectonemenu-trigger:hover
{
background-color: orange;
}
Now this works for hover but obviously changes as soon as the cursor is no longer hovering over it. Now I'm aware of the .ui-state-hover, .ui-state-focused etc. However doing the following has no effect
.ui-selectonemenu .ui-selectonemenu-trigger
{
background-color: blue;
}
.ui-selectonemenu .ui-selectonemenu-trigger .ui-state-hover,
.ui-selectonemenu .ui-selectonemenu-trigger .ui-state-focused
{
background-color: orange;
}
Any ideas?
Ok found the approach, we need to specify the container, the state and then the specific component class so the correct way is
.ui-widget-container .ui-state-hover .ui-selectonemenutrigger,
.ui-widget-container .ui-state-focus .ui-selectonemenutrigger
{
background-color: orange;
}
I'm using ZK and I want to make use of the ZK sclasses for the items in my .zul files.
I saw that you can use things like :
<style>
div.z-tree {
background: none !important;
background-image: none !important;
border: none !important;
}
div.z-tree-body {
background: none !important;
}
tr.z-treerow-seld, tr.z-treerow-over {
background: #00533f !important;
}
div.z-treecell-cnt {
color: #5555ff;
}
.test-class div.z-treecell-cnt {
color: #ff5555 !important;
}
</style>
Where can I find all those styles, like z-tree-body that I can use and all the attributes I can assign to them or how to search for them?
When I need to override some CSS, I always search the specific CSS classes with the browser developer tools.
Because you want to override the CSS of some nodes but not all, try to use sclass to a specific class of your own.
Example :
<style>
.red {
color:red;
}
<style/>
<label sclass="#load(empty vm.property?''':'red')" />
You don't need to use the zk classes if it's for particularisme cases. For overriding them all, you can beter use the zk classes.
I am learning Polymer. The app I'm building to learn Polymer uses the paper-item element. I've chosen the paper-item for its look. However, when I click the paper-item, the background changes to a dark gray. How do I remove this behavior? I want the background of the paper-item to always be white. Yet, cannot figure out how to set the background color when the paper-item is clicked or selected.
Thank you for your help and have a great holiday season!
I think it's the focused behavior that needs to be changed by redefining the mixin:
<template>
<style>
:root /* or paper-item */ {
--paper-item-focused: {
background-color: white;
}
}
</style>
<paper-item></paper-item>
</template>
If this doesn't work try --paper-item-selected instead of --paper-item-focused.
I think you looking for this :
paper-item:focus::before,
paper-item:focus::after {
color: white;
opacity: 0;
}
This rule override rules from "bower_components/paper-item/paper-item-shared-styles.html" :
:host(:focus):before, .paper-item:focus:before {
#apply(--layout-fit);
background: currentColor;
content: '';
opacity: var(--dark-divider-opacity);
pointer-events: none;
#apply(--paper-item-focused-before);
}
I don't know where is import the rule on "paper-item:focus::after" but in my Chrome Developper Console I see this and I need to override it to get the behavior you want.
Regards
I've managed to change the Logo the way I want it using Logo using CSS but I'm struggling to figure out how to change the hover color of it.
I want to change the TEST color on hover from blue to something else
http://test.peterstavrou.com/
At the moment my CSS code is
header#top #logo {
letter-spacing: 2px;
font-size: 35px;
}
your Logo-Text is a link so you should use css-syntax for styling links:
a#logo:link { color: #fff; } /* a Link that has not been clicked yet */
a#logo:visited { color: #fff; } /* a link that has been clicked before */
a#logo:hover { color: #ff0; } /* a link on hover/rollover */
a#logo:active { color: #ff0; } /* a link that is just clicked */
Just do something like:
Solutions 1 Find the logo hover css and change the color property value to whatever color you want
color: red!important; /* change the property value to the color you want */
Solution 2 Create another hover CSS and force a change as shown below, if the above doesn't work
#logo:hover {
color: red!important;
}
Note: Make sure the code above is at the very bottom of your css file. that way, it will override the previous hover property defined, even if it has important
Add this below the code for header#top #logo { ... } that your sample is showing in the CSS.
header#top #logo:hover
{
color:red;
}