Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 答:焦点不在';我不在ie工作_Html_Css_Internet Explorer_Focus - Fatal编程技术网

Html 答:焦点不在';我不在ie工作

Html 答:焦点不在';我不在ie工作,html,css,internet-explorer,focus,Html,Css,Internet Explorer,Focus,答:专注不仅仅在IE中起作用。 所以我正在寻找解决这个问题的方法,但目前还没有找到 <div class="city-selection"> <ul> <li><a href="#" tabindex="1"><span>Тольятти</span></a></li>

答:专注不仅仅在IE中起作用。 所以我正在寻找解决这个问题的方法,但目前还没有找到

<div class="city-selection">
                        <ul>
                            <li><a href="#" tabindex="1"><span>Тольятти</span></a></li>
                            <li class="city-right-text"><a href="#" tabindex="2"><span>Самара</span></a></li>
                        </ul>
                </div>
.city-selection ul li a:focus {
    background-image: url("/img/button.png");
    background-repeat:no-repeat;
    background-position: 3px 0px;
    outline: 0;
}

.城市选择ul li a:重点{ 背景图片:url(“/img/button.png”); 背景重复:无重复; 背景位置:3px0px; 大纲:0; }
在ie中找到了一个关于修复的主题:聚焦。

用于检查浏览器是否支持该链接中的“焦点”的代码:

var focusIsSupported = (function(){

// Create an anchor + some styles including ':focus'.
// Focus the anchor, test if style was applied,
// if it was then we know ':focus' is supported.

var ud = 't' + +new Date(),
    anchor = $('<a id="' + ud + '" href="#"/>').css({top:'-999px',position:'absolute'}).appendTo('body'),
    style = $('<style>#'+ud+'{font-size:10px;}#'+ud+':focus{font-size:1px !important;}</style>').appendTo('head'),
    supported = anchor.focus().css('fontSize') !== '10px';
anchor.add(style).remove();
return supported;

})();
var focusssupported=(函数(){
//创建一个锚点+一些样式,包括“:focus”。
//聚焦锚,测试是否应用了样式,
//如果是这样的话,我们就知道支持“:focus”。
变量ud='t'++new Date(),

anchor=$('。

只需使用javascript即可

document.getElementsByClassName('city-selection').focus();

它在其他浏览器中工作吗?你能添加JSFIDLE吗?是的,它在其他浏览器中工作。我不理解这个代码。你能解释我的代码示例吗?你检查了我提供的链接了吗?那里解释得很好。只需添加jquery代码;css中没有什么可更改的。该页面中还有一个演示。检查ie.Al中是否工作因此,请确保您在页面中声明了css,并且css位于外部样式表中。@sanchahous我还添加了一个。请检查这是否适用于IE。它似乎适用于我的设备。谢谢。这是帮助fullThank。它有效,我是JS新手,我刚刚开始学习它。