user3282071
user3282071

Reputation: 131

Hiding div with data-titles by CSS code?

I want to hide a few divs on a website. Each of them has its own data-title. Can I use this CSS code? I guess I should do this by using:

 {display: none;}

However, I have a big problem with producing the correct selector.

Divs unfortunately do not have names, and class - and they can only be distinguished by the data-title. I will be grateful for any help.

Upvotes: 1

Views: 21481

Answers (1)

LcSalazar
LcSalazar

Reputation: 16821

You can target elements by its properties on css with the selector element[property="value"], so:

div[data-title="something"] {
    display: none;
}

EDIT

About the comment's below on "use or not quotes" on css property selector, there was a question answered here on SO that covers the subject: CSS attribute selectors: The rules on quotes (", ' or none?)

Upvotes: 4

Related Questions