Remove blue highlight over html image when clicked

后端 未结 4 1005
暖寄归人
暖寄归人 2020-12-31 10:40

I am making a custom Application in Android. I am displaying a html page with an img tag inside a div.

相关标签:
4条回答
  • 2020-12-31 10:42

    It may be the background color or the border color on the div that includes the button. Else use a code like following to remove the css after click completely

    $("#myButton").click(function(){
       $("#displayPanel div").removeClass('someClass');
    });
    
    0 讨论(0)
  • 2020-12-31 10:52

    Try this:

    CSS

    .press, img, .press:focus, img:focus{
        outline: 0 !important;
        border:0 none !important;
    }
    
    0 讨论(0)
  • 2020-12-31 10:56

    You could use CSS:

    ** HTML **

    <button class="press">
        <img src="but.png" width="150" height="62" border="0"/>
    </button>
    

    ** CSS **

    .press{
        outline-width: 0;
    }
    
    .press:focus{
        outline: none;
    }
    

    Answer take from here: How to remove the border highlight on an input text element

    0 讨论(0)
  • 2020-12-31 11:04

    You can prevent selection on your page through css. You can change the * selector to the element selector you want to prevent from selection.

    /*IE9*/
    *::selection 
    {
        background-color:transparent;
    } 
    *::-moz-selection
    {
        background-color:transparent;
    }
    *
    {        
        -webkit-user-select: none;
        -moz-user-select: -moz-none;
        /*IE10*/
        -ms-user-select: none;
        user-select: none;
    
        /*You just need this if you are only concerned with android and not desktop browsers.*/
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }    
    input[type="text"], textarea, [contenteditable]
    {
    
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
    
    0 讨论(0)
提交回复
热议问题