Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are pseudo elements supported? #149

Open
chipsenkbeil opened this issue Dec 22, 2016 · 3 comments
Open

Are pseudo elements supported? #149

chipsenkbeil opened this issue Dec 22, 2016 · 3 comments

Comments

@chipsenkbeil
Copy link

chipsenkbeil commented Dec 22, 2016

You've got pseudo-selectors. Are psuedo-elements (https://developer.mozilla.org/en-US/docs/Web/CSS/pseudo-elements) supported in any form? Wanted to add ::after to an element.

I see mention of ::after here: https://github.com/lihaoyi/scalatags/blob/master/scalatags/shared/src/main/scala/scalatags/generic/Styles.scala#L575

@chipsenkbeil
Copy link
Author

I was trying to do the following, which almost works:

object MyStylesheet extends CascadingStyleSheet {
  import scalatags.Text.styles2.{content => afterContent}

  val someClass = cls(
    &.pseudoExtend(":after")(
      display := "inline-block",
      afterContent := "\\f107",
      opacity := 0.5,
      color := "#102429",
      fontSize := "inherit"
    )
  )
}

However, the content block gets converted into content: \f107; when I invoke styleSheetText. Without the quotes, it ends up breaking in the browser. If I try to insert quotes into the string, they get escaped into &quote;.

@chipsenkbeil
Copy link
Author

Looks like I can get around the problem by embedding single quotes.

afterContent := "'\\f107'"

@lihaoyi
Copy link
Member

lihaoyi commented Feb 4, 2017

They're not really supported right now, but I'd love a patch to make them work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants