Comments on: :blank https://css-tricks.com Tips, Tricks, and Techniques on using Cascading Style Sheets. Tue, 28 Jan 2020 06:18:31 +0000 hourly 1 https://wordpress.org/?v=6.5.5 By: Jass https://css-tricks.com/almanac/selectors/b/blank/#comment-1753897 Tue, 28 Jan 2020 06:18:31 +0000 http://css-tricks.com/?page_id=195116#comment-1753897 In CSS Selectors Level 4, :empty was redefined so it also matches whitespace and :blank only selects empty textareas and inputs.

Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/:blank

]]>
By: Altos https://css-tricks.com/almanac/selectors/b/blank/#comment-1616150 Thu, 15 Feb 2018 13:08:19 +0000 http://css-tricks.com/?page_id=195116#comment-1616150 This feature would be really useful and cool!

]]>
By: Geoff Graham https://css-tricks.com/almanac/selectors/b/blank/#comment-1616076 Mon, 12 Feb 2018 14:34:41 +0000 http://css-tricks.com/?page_id=195116#comment-1616076 In reply to Brian.

The demo in the post is a pretty good example of how helpful it can be in selecting specific blank content instances of what are otherwise the same HTML elements. It’s a distinguisher and, depending on your use case, that could be super helpful.

]]>
By: Brian https://css-tricks.com/almanac/selectors/b/blank/#comment-1616046 Sun, 11 Feb 2018 12:50:43 +0000 http://css-tricks.com/?page_id=195116#comment-1616046 In reply to Luca Rager.

This just selects the isEmpty div, no? How would that help with styling the container?

]]>
By: Wolfr https://css-tricks.com/almanac/selectors/b/blank/#comment-1608431 Sat, 06 May 2017 09:53:36 +0000 http://css-tricks.com/?page_id=195116#comment-1608431 Just came in here to say I found a need for this today. Basically I have slides on the left side and notes on the right side, divided by a flex container. If the notes div is empty it should actually not show (display: none;). But since it does contain some whitespace, something like :empty does not work.

We will solve it now by writing more backend code, but if something like can be solved by CSS that would make things a lot easier.

]]>
By: Wolfr https://css-tricks.com/almanac/selectors/b/blank/#comment-1608430 Sat, 06 May 2017 09:51:46 +0000 http://css-tricks.com/?page_id=195116#comment-1608430 In reply to Luca Rager.

This doesn’t really help if you want to add “display: none” to an empty section. We need something like :blank for that use case.

]]>
By: Ramon Caldeira https://css-tricks.com/almanac/selectors/b/blank/#comment-1605699 Thu, 22 Dec 2016 20:24:47 +0000 http://css-tricks.com/?page_id=195116#comment-1605699 In reply to Luca Rager.

Thank you!! It solved a huge problem I’ve been struggling with.

]]>
By: Luca Rager https://css-tricks.com/almanac/selectors/b/blank/#comment-1602185 Tue, 14 Jun 2016 14:30:33 +0000 http://css-tricks.com/?page_id=195116#comment-1602185 For anybody looking for a quick workaround (I used this with angular)
Drop a div in your container, and target it with :only-child

<div class="container">
   <div class="isEmpty"></div>
   <-- Your Code with ng-if or similar -->
</div>
.container > div.isEmpty:only-child {
   // Write fancy css code
}
]]>
By: Kuba Przetakiewicz https://css-tricks.com/almanac/selectors/b/blank/#comment-1600700 Mon, 04 Apr 2016 11:54:03 +0000 http://css-tricks.com/?page_id=195116#comment-1600700 This would be exceptionally useful in case of AngularJS comments for ng-if/ng-repeat, where the comments are absolutely mandatory – you cannot remove them and they have default indentation and line-breaks.

Generally AngularJS comments are a pain in the ass for several reasons: visual clutter in the DOM and being treated like a DOM node by a lot of CSS selectors, namely :first-child and :last-child.

]]>
By: Grant https://css-tricks.com/almanac/selectors/b/blank/#comment-1600078 Mon, 07 Mar 2016 11:20:21 +0000 http://css-tricks.com/?page_id=195116#comment-1600078 I really hope this makes it into the final CSS Selectors Level 4 spec as this would be really useful to have, rather than having to use JS.

]]>
By: Will https://css-tricks.com/almanac/selectors/b/blank/#comment-1598654 Fri, 18 Dec 2015 21:06:44 +0000 http://css-tricks.com/?page_id=195116#comment-1598654 p tags that is

]]>
By: Will https://css-tricks.com/almanac/selectors/b/blank/#comment-1598653 Fri, 18 Dec 2015 21:06:02 +0000 http://css-tricks.com/?page_id=195116#comment-1598653 Would this be a quick fix for empty

made by WordPress’s wautop?

]]>
By: Fewfre https://css-tricks.com/almanac/selectors/b/blank/#comment-1592639 Thu, 19 Feb 2015 14:54:51 +0000 http://css-tricks.com/?page_id=195116#comment-1592639 Hopefully this doesn’t get dropped from the draft. I’ve had a few cases where this would have been useful, and am glad it’s being addressed in some form!

]]>