简体   繁体   English

如何在wordpress cms中使用css从div中删除属性

[英]how to remove attribute from div using css in wordpress cms

I use wordpress cms for an e-commerce site, on my shop page pagination is not displayed and when I inspect element I see this 我将wordpress cms用于一个电子商务网站,在我的商店页面上没有显示分页,当我检查元素时,我看到了

<div class="shop-loop-after clearfix" style="opacity: 1; display: none;">
<nav class="woocommerce-pagination">

in inspection when I remove display:none from style attribute it work 在检查中,当我从样式属性中删除display:none ,它可以正常工作

I also tried this on shop page but it does not work 我也在商店页面上尝试过此方法,但它不起作用

document.getElementByClassName('shop-loop-after').removeAttr('style')

<div class="shop-loop-after clearfix" style="opacity: 1; display: none;">
<nav class="woocommerce-pagination">

I want to how to remove the display attribute using css 我想如何使用CSS删除display属性

Given this HTML: 鉴于此HTML:

<div class="item" style="display:none"></div>

With JavaScript: 使用JavaScript:

document.getElementsByClassName("item")[0].removeAttribute("style");

With CSS: 使用CSS:

.item{
    display: inherit !important;
}

Examples: 例子:

 document.getElementsByClassName("item")[0].removeAttribute("style"); 
 .item{ width: 300px; height: 300px; border: solid gray 3px; display: inherit !important; } 
 <div class="item" style="display:none"></div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM