:focus not working as expected in IE - css

I have a question on accessibility on a postchat survey window which I've worked on.There's a close button on the top right(as an image of X) where I've included visual focus by putting focus pseudo class, now the problem i'm facing is that the close button has white border around it when it is focused and this is happening as expected in chrome, Mozilla but in IE a blue border is coming. Can someone help me how to remove this blue border and bring white in its place?
I'm sharing the code snippet where I've used focus
a.close-link:focus {
outline: 1px dotted white;
}

Though active and focus are to different states but you can try both at same time for your purpose i think
:active Adds a style to an element that is activated
:focus Adds a style to an element that has keyboard input focus
:hover Adds a style to an element when you mouse over it
:lang Adds a style to an element with a specific lang attribute
:link Adds a style to an unvisited link
:visited Adds a style to a visited link
following source http://www.w3schools.com/CSS/css_pseudo_classes.asp
a.close-link:focus, a.close-link:active {
outline: 1px dotted white;
}

:FOCUS pseudo-class does work in IE, Instead, I believe your problem is with outline property.
Try this:
IE 9
George Langley wrote in to say that IE 9 apparently doesn't allow you
to remove the dotted outline around links unless you include this meta
tag:
<meta http-equiv="X-UA-Compatible" content="IE=9" />
((source))

Well i've found out a workaround. For IE9 border comes by default so I've removed border now and the blue outline is no more there!
a.close-link:focus {
outline: 1px dotted white;
}
a.close-link img {
border: none;
}

Related

How to display colors correctly using ::selection pseudo element

I'm styling the selected text in my document using the ::selection pseudo class.
div::selection {
color: white;
background-color: red;
}
span {
color:white;
background-color: red;
}
<div>Selected styled.</div>
Selected regular.
<span>Not Selected.</span>
When I select the styled text, the red is very visibly not the same color as regular red. It has a blue-ish overlay. This seems to be some sort of interaction between the default selection styles of the browser and my own styles.
How can I completely remove the browsers styling while keeping my own?
I've tried using user-select: none; in the html style, but that completely overrides all selection.
EDIT: I've just run this is firefox and it's fine, so this appears to be a Chrome specific issue.
EDIT: Here is a screenshot of what I see when selecting:
I'm using Google Chrome Version 74.0.3729.131 on a Mac.

How can I make the box for contenteditable text disappear?

I am using contenteditable on my web pages. This works fine but the browser puts an ugly border around the editable section when it is activated. Also, some of these borders are not erased when the focus is changed to another element on the page.
Safari creates a light blue border, Firefox uses a thin black line, so there is some browser interpretation at work here.
I have tried explicitly setting the border on the editable sections to none and making that CSS property important, but this does not change the browser's behavior.
My question:
Is there a way to influence the styling of the page element that overrules the border property when the user has clicked inside it to start editing?
Add this style (JsFiddle):
[contenteditable="true"]:active, [contenteditable="true"]:focus
{
border:none;
outline:none;
}
To let all contenteditable elements not use border and outline when focuesed.
EDIT: I found an excellent tutorial
Try adding outline:none in css for the form elements to remove the border highlight property outline:none in css for input elements.
For example:
input:focus{
outline:none;
}
textarea:focus{
outline:none;
}
select:focus{
outline:none;
}
For working code find the Jsfiddle link
[contenteditable="true"]:active,
[contenteditable="true"]:focus
{
border:none !important;
outline:none !important;
}

Remove default browser styling of active state of link?

Ive styled the :active state of a link already but when you click it in Chrome you get a blue outline as you can see in the 2nd button below:
How can I disable this styling, ideally for all browsers?
Adding outline: 0; to the CSS does the trick for form elements and buttons.
I believe what you are looking for is the CSS property outline.
For Example
a {
outline: none;
}
a { border: 0 }
You should edit the anchor tag's global CSS, not just for its active state. Also, look into modernizr.

IE8 not recognizing css :hover properly

I have a series of icons in my navigation. They should appear white by default, blue on hover. When the icon is clicked it gets an 'active' class assigned at which point it should still be white by default, but also white on hover.
In IE8 after class 'active' is assigned it stays blue, regarles of hover. I have this doctype on my page:
<!DOCTYPE html>
This is my CSS:
.appNav div {
color: #ffffff;
}
.appNav div:hover {
color: blue;
}
.appNav div.active {
color: #ffffff;
}
.appNav div.active:hover {
color: #ffffff;
}
Edit: as rink.attendant.6 asked, I'm using fontawesome for my icons, so they're font text icons.
There is no reason this should not work in IE 8
The :hover pseudo-class applies while the user designates an element
with a pointing device, but does not necessarily activate it.
See : http://www.w3.org/TR/css3-selectors/#the-user-action-pseudo-classes-hover-act for details.
Also :
Starting with Windows Internet Explorer 7, when the browser is in
standards-compliant mode (strict !DOCTYPE), you can apply the :hover
pseudo-class to any element, not only links. If the pseudo-class is
not applied specifically to an element in the selector, such as the a
tag, the Universal (*) Selector is assumed. Indiscriminate use of the
:hover pseudo-class can negatively impact page performance.
Still you could force IE to :hover on any elements and manage IE erratic support of :hover. But this is from the past.
This 'buggy' and not clear context invited developers to use javascript to achieve a better cross-browser behavior with jQuery.
Also, i see your doctype is html5. Did you htmlShim you page ?

Why does the CSS3 pseudo ::selection not change the color for all parts?

Why does the CSS3 pseudo-element selection not change all parts of the highlight? As you can see in this screenshot I have selected part of the page, and parts of the selection are the default bright blue color:
This is the CSS that I'm using, it is at the top of my CSS file:
::selection { background: #3B3B3B; color: #fff; }
::-moz-selection { background: #3B3B3B; color: #fff; }
It seems like the highlight for inputs (text, checkboxes, etc.) and white space does not change. Does anyone know why this is, and is there a way to change it for every part of the page so the highlight color is consistent? I'm using Chrome.
The ::selection pseudo-element doesn't work properly in Chrome/Safari. <input> elements will be the standard highlight color. It's a very old and still outstanding bug:
https://bugs.webkit.org/show_bug.cgi?id=38943
The only workaround I've been able to come up with is using contenteditable elements instead of <input> elements.
Here's a demo I created: http://jsfiddle.net/ThinkingStiff/FcCgA/
And a post I wrote about it: https://stackoverflow.com/a/8529323/918414

Resources