W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2018

Re: [csswg-drafts] [selectors] Postcede selector (#1705)

From: philsward via GitHub <sysbot+gh@w3.org>
Date: Thu, 06 Dec 2018 04:15:48 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-444742797-1544069747-sysbot+gh@w3.org>
I'd like to +1 this feature request.  On more than one occasion, I'm left to deal with poor HTML coding by someone else's hand and re-coding it is either not an option or too much of a pain.  I recently was met with an obstacle where an input was put inside of a label and the text for the label wasn't wrapped in anything, it was part of the label itself.  In other words, the input was completely cut off from any CSS styling because someone wasn't thinking...  In this use case I was trying to style :checked vs :not(:checked) but found it was impossible because the checkbox input was the last sibling in the chain.

Styling a previous selector is obviously not ideal and the HTML should be coded properly to account for these types of situations, however many of us are left to the coding of other people who either don't know any better or weren't paying attention.  "I need a fix now, not 6 months from now when xyz maintainer feels like getting around to fixing his code".  Since I don't code by nature, coming up with javascript workarounds or re-theming workarounds to someone else's code isn't possible.

Being able to style a previous selector based on a sibling condition, would be fantastic.

Code Example:

```
<div class="form-type-checkbox checkbox">
	<label class="control-label" for="edit-attributes-1">
		<input type="checkbox" id="edit-attribute-1" name="attributes[1]" class="form-checkbox ajax-processed">
	Free product with purchase!
	</label>
</div>
```

-- 
GitHub Notification of comment by philsward
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1705#issuecomment-444742797 using your GitHub account
Received on Thursday, 6 December 2018 04:15:50 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:40 UTC