Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. Using *:empty to Troubleshoot Your CSS
  2. Nicole Ramsey is a freelance developer for An Event Apart and QA Lead for Modern Tribe. She still views source when possible, wishes she could remember all shortcuts without a cheat sheet, and fusses with her dotfiles more than is necessary. Here, she shares a CSS troubleshooting tip:
  3.  
  4. One of the simplest, but most useful, tools in my QA toolkit is the *:empty pseudo selector. This selector affects elements that contain either nothing or only an HTML comment. Caveats: This won’t catch elements if there is whitespace and it will false-positive catch <img> elements.
  5.  
  6. Example
  7.  
  8. *:empty {border: 5px solid red;}
  9.  
  10. <p>Awesome content</p>
  11.  
  12. <p></p> <--unwanted output :empty will outline-->
  13.  
  14. <p>
  15. </p> <--this element would not be caught using :empty-->
  16.  
  17. Using this selector allows you to visually track down extraneous markup before you begin checking your stylesheets for margin/border/padding spacing issues on your page. You can add this easily as a new style rule using browser developer tools, too.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement