Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
旧浏览器jquery中的第n个子项(4n)_Jquery_Css_Wordpress_Html_Css Selectors - Fatal编程技术网

旧浏览器jquery中的第n个子项(4n)

旧浏览器jquery中的第n个子项(4n),jquery,css,wordpress,html,css-selectors,Jquery,Css,Wordpress,Html,Css Selectors,此代码在所有浏览器中都可以正常工作,但在internet explorer和旧浏览器中不起作用。对于旧的浏览器和internet explorer,也可以使用jquery来实现吗 .post {position:relative;float:left;width:207px;height:300px;margin-right:24px} .post:nth-child(4n) {margin-right:0px !important;} 你可以。在jQuery中,尝试 $(".post:nth

此代码在所有浏览器中都可以正常工作,但在internet explorer和旧浏览器中不起作用。对于旧的浏览器和internet explorer,也可以使用jquery来实现吗

.post {position:relative;float:left;width:207px;height:300px;margin-right:24px}
.post:nth-child(4n) {margin-right:0px !important;}

你可以。在jQuery中,尝试

$(".post:nth-child(4n)").css('margin-right', '0px !important');

他在问题中指定了jquery…因为他想在不支持选择器的浏览器中使用jquery实现样式?这些“帖子”是从服务器输出到页面的吗?如果是这样的话,那么直接在预期的元素上输出一个类并将该类用于样式化,而不是使用jQuery来完成,将会更容易、更轻松。