Reputation: 67
I've got the following code several times on a page:
<div>
<input class="entry">
</div>
I want to target the div tag through css without creating a class or id. Is this possible?
I tried div.entry { foo }
and .entry div {foo}
neither seemed to work.
Upvotes: 1
Views: 124
Reputation: 1442
You're not targeting the div with that CSS, you'll need to select the parent of the input that has the entry class. However, there's no way of doing this in current CSS but with selector specs of CSS4, which could be done as follows:
div! > input.entry { foo }
AFAIK, there's no browsers supporting this yet, so you'll have to use JavaScript.
Upvotes: 1