Module: StylesheetsHelper
- Defined in:
- lib/css_dryer_2/stylesheets_helper.rb
Instance Method Summary collapse
-
#ie6(&block) ⇒ Object
<% ie6 do %> css for ie6 here <% end %>.
-
#ie7(&block) ⇒ Object
<% ie7 do %> css for ie7 here <% end %>.
-
#self_clear(*selectors) ⇒ Object
Self-clearing.
Instance Method Details
#ie6(&block) ⇒ Object
<% ie6 do %>
css for ie6 here
<% end %>
8 9 10 |
# File 'lib/css_dryer_2/stylesheets_helper.rb', line 8 def ie6(&block) wrap '* html', &block end |
#ie7(&block) ⇒ Object
<% ie7 do %>
css for ie7 here
<% end %>
15 16 17 |
# File 'lib/css_dryer_2/stylesheets_helper.rb', line 15 def ie7(&block) wrap '* + html', &block end |
#self_clear(*selectors) ⇒ Object
Self-clearing. For example:
<%= self_clear ‘div#foo’, ‘img.bar’, ‘p ul’ %>
You can pass a hash as the final argument with these options:
:clear => 'left' | 'right' | 'both' (default)
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/css_dryer_2/stylesheets_helper.rb', line 25 def self_clear(*selectors) = selectors. clear = [:clear] || 'both' selector_template = lambda { |proc| selectors.map{ |s| proc.call s }.join ', ' } p = lambda { |selector| "#{selector}:after" } q = lambda { |selector| "* html #{selector}" } r = lambda { |selector| "*:first-child+html #{selector}" } <<-END #{selector_template.call p} { content: "."; display: block; height: 0; clear: #{clear}; visibility: hidden; } #{selector_template.call q} { height: 1%; } #{selector_template.call r} { min-height: 1px; } END end |