<输入类型=“文本”的圆角>>对 IE 使用 border-radius.htc

发布于 2024-09-10 00:29:08 字数 596 浏览 2 评论 0 原文

我想创建一个带有圆角的输入字段。

HTML:

<div id="RightColumn">
<input type="text" class="inputForm" />
</div>

CSS:

.inputForm
{
    -moz-border-radius:10px; /* Firefox */
    -webkit-border-radius: 10px; /* Safari, Chrome */
    -khtml-border-radius: 10px; /* KHTML */
    border-radius: 10px; /* CSS3 */
    behavior:url("border-radius.htc");
}

#RightColumn
{
    background-color:White;
}

但是 IE 不显示输入字段的任何边框 - 更圆润的边框或简单的边框。 当我删除 #RightColumn 的 CSS 样式时,IE 显示带有圆角的输入字段。 但我需要#RightColumn 的背景。

我怎样才能创建它?

I want to create an input fields with rounded corners.

HTML:

<div id="RightColumn">
<input type="text" class="inputForm" />
</div>

CSS:

.inputForm
{
    -moz-border-radius:10px; /* Firefox */
    -webkit-border-radius: 10px; /* Safari, Chrome */
    -khtml-border-radius: 10px; /* KHTML */
    border-radius: 10px; /* CSS3 */
    behavior:url("border-radius.htc");
}

#RightColumn
{
    background-color:White;
}

But IE doesn't show any borders for input fields - neighter rounded nor simple borders.
When I remove CSS-style for #RightColumn, IE shows an input fields with rounded corners.
But I need background for #RightColumn.

How can I create it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

若沐 2024-09-17 00:29:08

哦主啊,不要这样做。出于性能和清晰度方面的原因,HTC 文件从来都不是一个好主意,并且您使用了太多供应商特定的参数来完成可以轻松跨浏览器一直到 IE6 完成的操作。

将背景图像应用到带有圆角的输入字段,并使用 border:none 使字段的背景颜色透明。

Oh lord, don't do it this way. HTC files are never a good idea for performance and clarity reasons, and you're using too many vendor-specific parameters for something that can easily be done cross-browser all the way back to IE6.

Apply a background image to your input field with the rounded corners and make the field's background colour transparent with border:none applied instead.

雄赳赳气昂昂 2024-09-17 00:29:08
    border-bottom-color: #b3b3b3;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-left-color: #b3b3b3;
    border-left-style: solid;
    border-left-width: 1px;
    border-right-color: #b3b3b3;
    border-right-style: solid;
    border-right-width: 1px;
    border-top-color: #b3b3b3;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    border-top-style: solid;
    border-top-width: 1px;

...谁在乎IE6,我们已经在2011年升级了,请醒来吧!

    border-bottom-color: #b3b3b3;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-left-color: #b3b3b3;
    border-left-style: solid;
    border-left-width: 1px;
    border-right-color: #b3b3b3;
    border-right-style: solid;
    border-right-width: 1px;
    border-top-color: #b3b3b3;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    border-top-style: solid;
    border-top-width: 1px;

...Who cares IE6 we are in 2011 upgrade and wake up please!

兮颜 2024-09-17 00:29:08

如果您用于某些文本字段,则使用类

<style>
  .inputForm{
      border-radius:5px;
      -moz-border-radius:5px;
      -webkit-border-radius:5px;
   }
</style>

并在html代码中使用

 <input type="text" class="inputForm">

,或者如果您想对所有输入类型文本字段执行此操作,则意味着使用

<style>
    input[type="text"]{
      border-radius:5px;
      -moz-border-radius:5px;
      -webkit-border-radius:5px;
    }
 </style>

并在html代码中

<input type="text" name="name">

if you are using for certain text field then use the class

<style>
  .inputForm{
      border-radius:5px;
      -moz-border-radius:5px;
      -webkit-border-radius:5px;
   }
</style>

and in html code use

 <input type="text" class="inputForm">

or if u want to do this for all the input type text field means use

<style>
    input[type="text"]{
      border-radius:5px;
      -moz-border-radius:5px;
      -webkit-border-radius:5px;
    }
 </style>

and in html code

<input type="text" name="name">
暖伴 2024-09-17 00:29:08

但这在 IE<9 中不起作用,但是,您可以使用以下命令让 IE 支持:

CSS3Pie

PIE 使 Internet Explorer 6-8
能够渲染其中的几个
最有用的 CSS3 装饰功能。

That won't work in IE<9 though, however, you can make IEs support that using:

CSS3Pie

PIE makes Internet Explorer 6-8
capable of rendering several of the
most useful CSS3 decoration features.

坏尐絯℡ 2024-09-17 00:29:08

W3C 文档关于“border-radius”属性的说明:“在 IE9+ 中受支持, Firefox、Chrome、Safari 和 Opera”。

因此我假设您正在 IE8 或更低版本上进行测试。

对于“常规元素”,有一个与 IE8 和 IE8 兼容的解决方案。其他旧的/较差的浏览器。见下文。

HTML:

<div class="myWickedClass">
  <span class="myCoolItem">Some text</span> <span class="myCoolItem">Some text</span> <span class="myCoolItem"> Some text</span> <span class="myCoolItem">Some text</span>
</div>

CSS:

.myWickedClass{
  padding: 0 5px 0 0;
  background: #F7D358 url(../img/roundedCorner_right.png) top right no-repeat scroll;
  -moz-border-radius: 10px;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  font: normal 11px Verdana, Helvetica, sans-serif;
  color: #A4A4A4;
}
.myWickedClass > .myCoolItem:first-child {
  padding-left: 6px;
  background: #F7D358 url(../img/roundedCorner_left.png) 0px 0px no-repeat scroll;
}
.myWickedClass > .myCoolItem {
  padding-right: 5px;
}

您需要创建 roundedCorner_right.pngroundedCorner_left.png。这些是 IE8(及以下)的解决方法,可以伪造圆角功能。

因此,在上面的示例中,我们将左圆角应用于包含 div 中的第一个 span 元素,&我们将右圆角应用于包含的 div。这些图像与浏览器提供的“方角”和“方角”重叠。给人一种成为圆形元素一部分的错觉。

输入的想法是执行相同的逻辑。然而,input是一个空元素,“元素是空的,它只包含属性”,换句话说,你不能将span包装到input中,例如 然后像前面的示例一样使用背景图像。

因此,解决方案似乎是做相反的事情:将输入包装到另一个元素中。请参阅此答案IE 中输入元素的圆角

W3C doc says regarding "border-radius" property: "supported in IE9+, Firefox, Chrome, Safari, and Opera".

Hence I assume you're testing on IE8 or below.

For "regular elements" there is a solution compatible with IE8 & other old/poor browsers. See below.

HTML:

<div class="myWickedClass">
  <span class="myCoolItem">Some text</span> <span class="myCoolItem">Some text</span> <span class="myCoolItem"> Some text</span> <span class="myCoolItem">Some text</span>
</div>

CSS:

.myWickedClass{
  padding: 0 5px 0 0;
  background: #F7D358 url(../img/roundedCorner_right.png) top right no-repeat scroll;
  -moz-border-radius: 10px;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  font: normal 11px Verdana, Helvetica, sans-serif;
  color: #A4A4A4;
}
.myWickedClass > .myCoolItem:first-child {
  padding-left: 6px;
  background: #F7D358 url(../img/roundedCorner_left.png) 0px 0px no-repeat scroll;
}
.myWickedClass > .myCoolItem {
  padding-right: 5px;
}

You need to create both roundedCorner_right.png & roundedCorner_left.png. These are work around for IE8 (& below) to fake the rounded corner feature.

So in this example above we apply the left rounded corner to the first span element in the containing div, & we apply the right rounded corner to the containing div. These images overlap the browser-provided "squary corners" & give the illusion of being part of a rounded element.

The idea for inputs would be to do the same logic. However, input is an empty element, " element is empty, it contains attributes only", in other word, you cannot wrap a span into an input such as <input><span class="myCoolItem"></span></input> to then use background images like in the previous example.

Hence the solution seems to be to do the opposite: wrap the input into another element. see this answer rounded corners of input elements in IE

农村范ル 2024-09-17 00:29:08

从手机上书写,但 curvycorners 确实很好,因为只有当浏览器默认不支持它时,它才会添加自己的边框。换句话说,已经支持某些 CSS3 的浏览器将使用自己的系统来提供角点。
https://code.google.com/p/curvycorners/

Writing from phone, but curvycorners is really good, since it adds it's own borders only if browser doesn't support it by default. In other words, browsers which already support some CSS3 will use their own system to provide corners.
https://code.google.com/p/curvycorners/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文