Posted By

dougunderscorenelson on 04/28/09


Tagged

jquery tag hr


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

rsoule
talbs
keith
ramnath
robotici


Wrap Your HRs for Easy Stylin'


 / Published in: jQuery
 

HRs are a pain in the ass to style, so why bother? Wrap them in a DIV with a class of HR instead. (In your stylesheet, set .hr hr { display: none }).

This also ports the class of the HR up to the new parent DIV, allowing you to make a few different HR types that clients can easily work with.

  1. $("hr").each(function() {
  2. var hrClass = jQuery(this).attr("class")
  3. $(this).wrap("<div class='hr " + hrClass +"'></div>");
  4. });

Report this snippet  

You need to login to post a comment.