class CSS
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Create a Cascading Style Sheet (CSS) using Ruby.
Example usage:
css = Builder::CSS.new
text_color = '#7F7F7F'
preferred_fonts = 'Helvetica, Arial, sans_serif'
css.comment! 'This is our stylesheet'
css.body {
background_color '#FAFAFA'
font_size 'small'
font_family preferred_fonts
color text_color
}
css.id!('navbar') {
width '500px'
}
css.class!('navitem') {
color 'red'
}
css.a :hover {
text_decoration 'underline'
}
css.div(:id => 'menu') {
background 'green'
}
css.div(:class => 'foo') {
background 'red'
}
This will yield the following stylesheet:
/* This is our stylesheet */
body {
background_color: #FAFAFA;
font_size: small;
font_family: Helvetica, Arial, sans_serif;
color: #7F7F7F;
}
#navbar {
width: 500px;
}
.navitem {
color: red;
}
a:hover {
text_decoration: underline;
}
div#menu {
background: green;
}
div.foo {
background: red;
}
Inherits from
Methods (defined here)
Private methods
(11)
Implementation detail — not part of the public API.
- # _css_block
- # _css_line
- # _end_block
- # _end_container
- # _indent
- # _join_with_op!
- # _nested_structures
- # _newline
- # _start_container
- # _text
- # _unify_block
Methods (inherited)
From BlankSlate (3)
- self. find_hidden_method
- self. hide
- self. reveal
From Object (37)
- # acts_like?
- # app
- # as_json
- # blank?
- # class_eval
- # create
- # create_fixtures
- # destroy
- # duplicable?
- # edit
- # find_cmd
- # helper
- # html_safe?
- # index
- # instance_exec
- # instance_variable_defined?
- # instance_variable_names
- # message
- # metaclass
- # new_session
- # presence
- # present?
- # reload!
- # returning
- # singleton_class
- # tap
- # to_json
- # to_param
- # to_query
- # try
- # unescape
- # update
- # with_options
- self. blank_slate_method_added
- self. find_hidden_method
- self. lookup_missing_generator
- self. method_added