[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE6 button的宽度问题 #19

Closed
wants to merge 3 commits into from
Closed

IE6 button的宽度问题 #19

wants to merge 3 commits into from

Conversation

kennx
Copy link
@kennx kennx commented Apr 29, 2013

如果不指定button的宽度,宽度要比其他浏览器要宽一些。

@sofish
Copy link
Owner
sofish commented Apr 30, 2013

来个 demo?

@kennx
Copy link
Author
kennx commented May 2, 2013

@sofish

用IE6 打开 http://knowhow.davidgrudl.com/css/styling-forms/demo4.html

好吧,我发现IE7也是一样。我用这个 http://netrenderer.com/ 在线测试出来的

* html button {
width: auto;
overflow:visible;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 hack 是这样的 * < html < button 这样的顺序,建议这样:

input, button {
  *width: auto;
  *overflow: visible;
}

ref: Use Efficient CSS Selectors

testcase

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>remove extra padding of a button</title>
    <style type="text/css">

    input, button{padding:2px 5px;}

    .success input, .success button {
      *width: 0;
      *overflow: visible;
    }
    </style>
</head>

<body>
    <h3>1. Origin:</h3> 
    <p><button>&lt;button&gt;</button>
    <p><input value="&lt;input type=button /&gt;" type="button" />

    <div class="success">
        <h3>2. Expect:</h3> 
        <p><button>&lt;button&gt;</button>
        <p><input value="&lt;input type=button /&gt;" type="button" />
    </div>
</body>
</html>

@sofish
Copy link
Owner
sofish commented May 14, 2013

已加

@sofish sofish closed this May 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants