html - :not(:first-of-type) equivilent for IE

标签 html css internet-explorer

我有一个包含多个字段集的表单,然后使用下面的代码将它们堆叠在一起。 Javascript 使用前进和后退按钮旋转字段集。它们不适用于没有兼容模式的 IE11。 我知道我可以使用旧的 css2 first-child:before 来完成这项工作,但我遇到了麻烦

http://jsfiddle.net/rCd26/901/

工作火狐和 Chrome

#AUTO fieldset:not(:first-of-type) {
display: none;/*remove to see all feildsets*/
}

IE 不工作

#AUTO fieldset:first-child:before {
display: none;/*remove to see all feildsets*/
}

我的 IE 代码做错了什么?为什么 IE 迟钝?

/*form styles*/
#AUTO {
display:table;/*makes div fill content*/
width: 100%;
height:auto;
margin:0 auto;
position: relative;
border:1px solid green; /*visual aid to make sure div fills content*/
margin-bottom:30px;
}
#AUTO fieldset {text-align:center;
width: 95%;margin:0 auto;
border:1px solid red; /*visual aid to make sure div fills content*/
box-shadow: 2px 2px 2px 2px #000;
background-color:#FFF;
display:table;/*makes div fill content*/
}
#miles{
display:none;/*spamer fills this out and it gets rejected my mail         script*/
}
/*Hide all except first fieldset*/
#AUTO fieldset:not(:first-of-type) {
display: none;/*remove to see all feildsets*/
}
#AUTO fieldset:first-child:before {
display: none;/*remove to see all feildsets*/
} 
<form id="AUTO"   method="post" action="inc/estimate.php">



<!-- fieldsets -->
<fieldset>
    <div class="div1"><img src="images/step1.png" width="233" height="65"></div>

<h3>CONTACT INFO</h3>


<div id="contact_name">FULL NAME: *<br>
<input id="element_2_1" name="name" class="element text" size="15" maxlength="15" value="" type="text" placeholder="FULL NAME"></div> 	
	

<div id="contact_phone">PHONE NUMBER: *<br>
<input id="element_1" name="phone" class="element text medium" type="text" maxlength="255" value="" placeholder="PHONE NUMBER"/></div> 

<div id="contact_email">EMAIL:<br>
<input id="element_1" name="email" class="element text medium" type="text" maxlength="255" value="" placeholder="EMAIL ADDRESS"/>
</div> 

<div class="button_holder">
<input type="button" name="next" class="next action-button" value="Next"/>
</div>



</fieldset>





<fieldset>
<div class="div1"><img src="images/step2.png" width="233" height="65"></div>


<h3>VEHICLE INFO</h3>

<div id="contact_name">VEHICLE MAKE: *<br>
<input id="element_2_1" name="make" class="element text" size="15" maxlength="15" value="" type="text" placeholder="FULL NAME"></div> 	
	

<div id="contact_phone">VEHICLE MODEL: *<br>
<input id="element_1" name="model" class="element text medium" type="text" maxlength="255" value="" placeholder="PHONE NUMBER"/></div> 

<div id="contact_email">YEAR*:<br>
<input id="element_1" name="year" class="element text medium" type="text" maxlength="255" value="" placeholder="EMAIL ADDRESS"/>
</div> 


<div id="contact_name">VIN NUMBER: <br>
<input id="element_2_1" name="vin" class="element text" size="15" maxlength="15" value="" type="text" placeholder="FULL NAME"></div> 	
	

<div id="contact_phone">INSURANCE COMPANY ( if applicable ):<br>
<input id="element_1" name="insurance_company" class="element text medium" type="text" maxlength="255" value="" placeholder="PHONE NUMBER"/></div> 






<div class="button_holder">
<input type="button" name="next" class="next action-button" value="Next"/>
<input type="button" name="previous" class="previous action-button" value="Previous"/>
</div>


</fieldset> 

<fieldset>
<div class="div1"><img src="images/step3.png" width="233" height="65"></div>
<div class="button_holder">
<input type="button" name="next" class="next action-button" value="ALMOST DONE"/>
<input type="button" name="previous" class="previous action-button" value="Previous" />
</div>
</fieldset> 

<fieldset>
<div class="div1"><img src="images/step4.png" width="233" height="65"></div>

<h4>THANK YOU!</h4>
<h5>Once you hit Submit you receive an email confirming your submission.</h5>

<div class="button_holder">
<input type="submit" name="submit" class="submit action-button" value="SUBMIT" />
<input type="button" name="previous" class="previous action-button" value="Previous"  />

</div>

</fieldset> 



</form>
enter image description here

最佳答案

如果你想在第一个之后隐藏所有的 fieldsets 你有其他简单的解决方案:

同级选择器

#AUTO fieldset ~ fieldset {
   display: none;/*remove to see all feildsets*/
}

http://jsfiddle.net/rCd26/902/


相邻选择器

#AUTO fieldset + fieldset {
  display: none;/*remove to see all feildsets*/
}

http://jsfiddle.net/rCd26/903/


全部隐藏/首先显示

#AUTO fieldset {
  display:none
}
#AUTO fieldset:first-child {
  display: block;
}

http://jsfiddle.net/rCd26/904/

关于html - :not(:first-of-type) equivilent for IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37682446/

相关文章:

jquery - 如何防止选项卡重叠?

css - 如何正确地将完整的 css3 选择器写入 querySelectorAll

jquery - jquery 移动 header 中的垂直控制组

internet-explorer - 如果以管理员身份运行 IE,Firebreath 插件无法在 IE9/IE10 中加载

jquery - 在页面加载时为 bootstrap 2.0 更改 body 标签

javascript - 在 jQuery 中添加工具提示

php - 使用来自 sql 数据库的 href 和 php 对 html 表进行排序

jquery - 为 Accordion 菜单设置动画时选项卡会弹跳

javascript - 通过 JavaScript 动态设置的 Iframe src 在 Internet Explorer 上执行了两次

javascript - 嵌入式对象后面的 jquery 组合框(仅限 IE)