Yes, you can use the ampersand to refer to the parent selector.
.foo
&.bar
:width 100px
Generates:
.foo.bar {width: 100px;}
You can use the ampersand anywhere in a rule:
.foo
html &:hover
:font-weight bold
Generates:
html .foo:hover {font-weight: bold;}
Also note that & refers to the fully expanded parent selector and not the
immediate parent context so
body
.foo
html &:hover
:color red
Generates:
html body .foo:hover {color: red;}
-chris
On Sun, Jan 11, 2009 at 4:20 PM, [email protected] <
[email protected]> wrote:
>
> Don't know if this is possible, or maybe in the pipeline for a sass
> update
>
> Is there a way to achieve something like this in sass
>
> .red_arrow
> :background-image url('icon.gif')
> :background-position 0 0
> :padding 0 0 0 20px
> .right
> :padding 0 20px 0 0
>
> Instead of having to do it like this
>
> .red_arrow
> :background-image url('icon.gif')
> :background-position 0 0
> :padding 0 0 0 20px
> .red_arrow.right
> :padding 0 20px 0 0
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---