IE8 / IE7设计按键问题(附截图)

时间:2014-03-11 13:30:18

标签: html css internet-explorer-8

我正在尝试创建一个符合跨浏览器标准的按钮(Here's a screenshot)enter image description here

在IE10和IE9上看起来还不错。

主要问题:

  1. IE8:添加了一个ie8类来创建红色箭头,HEAD中的代码是否正确?因为我希望在任何IE9及更低版本上都有html5shiv(用于其他需求), 但是对于这个特定的按钮,我想要一个特殊的类来绘制箭头。 这两条线可以结合在一起吗?
  2. HEAD:

    <!--[if lt IE 9]><script src="html5shiv.js"></script><![endif]-->
    <!--[if IE 8 ]> <html class="ie8"> <![endif]-->
    
    1. IE8:当我从.aaa删除.ie8 .aaa .button1{padding-right:4px;width:94px}时, 它拧起衬垫,使其在左侧更宽。我不知道为什么,因为类aaa根本不存在于html中。

    2. IE7:有没有办法让IE7具有相似的外观?

    3. 有关更好的做法的其他评论吗?

    4. 这是我的代码:

      HTML:

      <form action="a.htm" method="POST" target="_blank">
      <div class="button-holder"><input type="submit" class="button1" value="Hello">
      <span class="arrow"></span>
      </div>
      </form>
      

      CSS:

      .button-holder {
          float: left;
          margin-left: 0px;
          position: relative;
      }
      
      .button1 {
          padding: 4px 30px 4px 8px;
          border-style: solid;
          border-radius: 4px;
          font-size: 17px;
          line-height: 22px;
      }
      
      .arrow:after {
      -webkit-transform: rotate(-45deg);
      -moz-transform: rotate(-45deg);
      -ms-transform: rotate(-45deg);
      -o-transform: rotate(-45deg);
      transform: rotate(-45deg);
      }
      
      
      .arrow:before {
      -webkit-transform: rotate(45deg);
      -moz-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
      -o-transform: rotate(45deg);
      transform: rotate(45deg);
      margin-top: 6px;
      }
      .arrow:before, .arrow:after {
      content: "";
      position: absolute;
      background-color: red;
      height: 11px;
      top: 6px;
      right: 10px;
      width: 3px;}
      
      .button1 {
      border-style: solid;
      -webkit-border-radius: 5px;
      -moz-border-radius-: 5px;
      border-radius: 5px;
      -moz-box-shadow: 0 1px 4px 1px rgba(0,0,0,0.3);
      -webkit-box-shadow: 0 1px 4px 1px rgba(0,0,0,0.3);
      box-shadow: 0 1px 4px 1px rgba(0,0,0,0.3);
      background-color: #FFE76E;
          background-image: -moz-linear-gradient(center top,#F90,#FC0);
          background-image: -webkit-gradient(linear, 50.00% 100.00%, 50.00% 0.00%, color-stop( 0% , rgba(255,198,1,1.00)),color-stop( 100% , rgba(255,248,162,1.00)));
          background-image: -ms-linear-gradient(top,#F90 0,#FC0 100%);
          background-image: -webkit-linear-gradient(90deg,rgba(255,198,1,1.00) 0%,rgba(255,248,162,1.00) 100%);
          background-image: linear-gradient(0deg,rgba(255,198,1,1.00) 0%,rgba(255,248,162,1.00) 100%);
      text-decoration: none;
      font-family: Arial,Helvetica,Arial,sans-serif;
      font-weight:bold;
      color: #003!important;
      text-align: center;
      display: inline-block;
      border: 0;}
      
      .button1:hover, .button1:focus {
          background-color: #FFC808;
          background-image: -moz-linear-gradient(center top,#F90,#FC0);
          background-image: -webkit-gradient(linear, 50.00% 100.00%, 50.00% 0.00%, color-stop( 0% , rgba(237,162,0,1.00)),color-stop( 100% , rgba(255,234,93,1.00)));
          background-image: -ms-linear-gradient(top,#F90 0,#FC0 100%);
          background-image: -webkit-linear-gradient(90deg,rgba(237,162,0,1.00) 0%,rgba(255,234,93,1.00) 100%);
          background-image: linear-gradient(0deg,rgba(237,162,0,1.00) 0%,rgba(255,234,93,1.00) 100%);
          text-decoration: none;
      }
      
      
      .ie8 .aaa .button1{padding-right:4px;width:94px}
      .ie8 .arrow:before,.ie8 .arrow:after{background-color:transparent}
      .ie8 .arrow:after { 
      font-size:40px;
      font-size:4rem;
      content:"›";
      font-family:Arial,sans-serif;
      line-height:11px;
      text-indent:-5px;
      color:red;
      } 
      

1 个答案:

答案 0 :(得分:0)

对于边框半径和框阴影,您可以尝试:http://fetchak.com/ie-css3/