Skip to content

How to select tags in a stylesheet #237

@leleogere

Description

@leleogere

I might be missing something, but I can't figure out how to select tags (not classes) in a stylesheet.

I managed to get that working for classes:

object Style extends StyleSheet {
  initStyleSheet()
  val date = cls(color := "red")
}

val document = html(
  head(
    scalatags.Text.tags2.style(Style.styleSheetText)
  ),
  h1("Report"),
  h2(Style.date)("2022-05-17")
)

But how do I select the h1 tag for example? How do I generate something like the following in the stylesheet generated by my Style object?

h1 {
  color: blue;
}

I feel like I'm missing something very obvious but I can't find anything working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions