css a{}不起作用 链接那块

html-css023

css a{}不起作用 链接那块,第1张

可能在里面还设置了style啊,你去html的a标签里看一下,是不是有style,或者你在你的css里面,每句后面都加上!important

这样

a:visited { text-decoration: none !importantcolor: blue}

a:hover {text-decoration: none !importantcolor: #FF6600}

a:active { text-decoration:blink !importantcolor: #000000}

使用z-index:来给元素层定位置。\x0d\x0a\x0d\x0aCSS pointer-events\x0d\x0aPointer-events原本来源于SVG,目前在很多浏览器中已经得到体现。不过,要让任何HTML元素生效还得借助于一点点css。该属性称之为pointer-events,基本上可以将它设置为auto,这是正常的行为,而“none”是一个有趣的属性。\x0d\x0a将它应用到一个元素\x0d\x0a如果你已经设置一个元素的css属性为pointer-events: none。它将不会捕获任何click事件,而是让事件穿过该元素到达下面的元素,就像这样:\x0d\x0a

If you want to prevent the click events in IE that, as shasi pointed out, is prevented in other browsers, simply add an event listener that delegates the click event.

I'll assume, at the moment, that you're targeting all a elements:

<script>

var handler = function(e)

{

    e = e || window.event

    var target = e.target || e.srcElement

    if (target.tagName.toLowerCase() === 'a')

    {

        if (!e.preventDefault)

        {//IE quirks

            e.returnValue = false

            e.cancelBubble = true

        }

        e.preventDefault()

        e.stopPropagation()

    }

}

if (window.addEventListener)

    window.addEventListener('click', handler, false)

else

    window.attachEvent('onclick', handler)

    </script>

That should prevent all click events on anchor elements.

地址stackoverflow.com/questions/17441810/pointer-events-none-does-not-work-in-ie9-and-ie10

国外的解决方法。可以参考下