문제

I have used input type image to display my custom style buttons, but for some reason IE8 shows border even when I set in CSS border to none. In other browsers it is not showing border at all.

input[type=image] {
    margin: 0px; 
    padding: 0px;
    border: none;
    border-width: 0px;
    border-style: none;
    background-color: none;
}
도움이 되었습니까?

해결책

IE doesn't support that selector very consistently in my experience; give the input a class and then style it with that instead.

<input type="image" class="imageinput" name="whatever" />

input.imageinput {
    margin: 0px; 
    padding: 0px;
    border: none;
    background-color: none;
}

다른 팁

Use the outline CSS property:

input[type="image"] {
    border: none;
    outline: none;
}

outline draws a line around the element's margin, without contributing to the element width, and in this case IE8 might have a default outline specified. Read more about it at W3Schools.

first of all thanks for asking this question. I've faced this prob a year ago, you can choose the way you need but what I've done is simply imported this CSS as the starting point in my style.css and because of which it doesn't provides me an undesirable output

/* Reset CSS */

body, html {
    height:100%;
}
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
    border:0;
    outline:0;
    font-size:100%;
    vertical-align:baseline;
    background:transparent;
    margin:0;
    padding:0;
}
body {
    line-height:1;
}
ol, ul {
    list-style:none;
}
blockquote, q {
    quotes:none;
}
blockquote:before, blockquote:after, q:before, q:after {
    content:none;
}
:focus {
    outline:0;
}
del {
    text-decoration:line-through;
}
table {
    border-collapse:collapse;
    border-spacing:0;
}

/* Floating & Alignment  */

.fl {
    float:left;
}
.fr {
    float:right;
}
.ac {
    text-align:center;
}
.ar {
    text-align:right;
}

/* Clear Floats  */

.col-full:after {
    content:".";
    display:block;
    height:0;
    clear:both;
    visibility:hidden;
}
.fix {
    clear:both;
    height:1px;
    overflow:hidden;
    margin:-1px 0 0;
}
html body * span.clear, html body * div.clear, html body * li.clear, html body * dd.clear {
    background:none;
    border:0;
    clear:both;
    display:block;
    float:none;
    font-size:0;
    list-style:none;
    overflow:hidden;
    visibility:hidden;
    width:0;
    height:0;
    margin:0;
    padding:0;
}

If you'll keep an habit of importing this css it will never provide you an undesirable output in any browser.

Thanks!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top