Reset Styles for input elements and restyling to bring back the default appearance

前端 未结 2 621
無奈伤痛
無奈伤痛 2021-01-19 03:44

I have a simple input field.



        
2条回答
  •  悲哀的现实
    2021-01-19 04:37

    Short answer is change

    border: 1px inset #F0F0F0;

    to

    border: 1px solid #A9A9A9;


    Long Answer

    I feel there is a better answer to the problem that the OP had in their fiddle.

    The problem was with their use of inset instead of solid.

    Here is the original js Fiddle code:

    input
    {
        padding: 0;
        margin: 0;
    }
    
    input[name="1"]
    {
        margin: 10px;
    }
    
    input[name="2"]
    {
        border: none;
        border: 0;
        border: 1px inset #F0F0F0;
    }
    
    

    Here is the fix that I believe the OP was looking for:

    input
    {
        padding: 0;
        margin: 0;
    }
    
    input[name="1"]
    {
        margin: 10px;
    }
    
    input[name="2"]
    {
        border: 1px solid #A9A9A9;
    }
    
    

    All I changed was the

    input[name="2"]
    {
        border: none;
        border: 0;
        border: 1px inset #F0F0F0;
    }
    

    to

    input[name="2"]
    {
        border: 1px solid #A9A9A9;
    }
    

    There is no need to set border to none then set it to 0 and then set it to your desired settings. The only reason to do this would to be if there were different fallback options necessary for different browsers. But as far as I know all browsers that should be considered support the basic border property with the shorthand above. As for the actual settings that I changed, the inset gives you that old 3D-ish looking cut in look and the color was too close to the jsFiddle background plus this color looks closer to the default I see in most browsers.

提交回复
热议问题