简体   繁体   中英

css selector or xpath selector

I have a div in the code. I dont want to display it or delete it. Either is ok

the following is the code:

  <div addthis:url="http://sampletest.com/?p=2748" class="addthis_toolbox addthis_default_style " addthis:title="Clarifying the event "></div>

this is from wordpress page.

I dont know in css how to select addthis:url="http://sampletest.com/?p=2748" and addthis:title="Clarifying the event " because class="addthis_toolbox addthis_default_style is not unique thing to slect

I tried using javascript

    element = document.evaluate('//div[@addthis:url="http://sampletest.com/?p=2748"]',
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);

but it selects none.

It has a class. All you have to do is target that class in your CSS.

The class is addthis_toolbox , so the following will hide the div and its contents.

.addthis_toolbox {
    display: none;
}

Just make sure this class isn't used in other elements that you don't wish to hide, otherwise they'll be hidden as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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