::before/after on Elements Styled with display: table-*

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lachlan Hunt

    ::before/after on Elements Styled with display: table-*

    Hi,
    I was wondering if ::before and ::after pseudo-elements can apply to
    elements styled with the display: table-* properties. None of my tests
    worked in either Firefox or Opera, yet I could not find anywhere in
    either the CSS2.1, CSS3 Selectors or CSS3 Generated and Replaced Content
    Module specs that defines which elements these pseudo-elements actually
    apply to.

    Specifically, I was wondering if something like this were possible:

    table>:not(col) :not(colgroup): first-child::before {
    /* Should work with thead, tfoot, tbody or tr (whichever comes first
    * in the table), if not preceded by a col or colgroup element.
    */
    display: table-column;
    background: green;
    }
    --
    Lachlan Hunt

    http://GetFirefox.com/ Rediscover the Web
    http://GetThunderbird.com/ Reclaim your Inbox
  • Christoph Päper

    #2
    Re: ::before/after on Elements Styled with display: table-*

    Lachlan Hunt:[color=blue]
    > I was wondering if ::before and ::after pseudo-elements can apply to
    > elements styled with the display: table-* properties.[/color]

    They should, AFAICT.
    [color=blue]
    > table>:not(col) :not(colgroup): first-child::before {
    > /* Should work with thead, tfoot, tbody or tr (whichever comes first
    > * in the table), if not preceded by a col or colgroup element.
    > */[/color]

    Note that the 'tr' case will only ever occur in XHTML and HTML 3.2, but
    never in HTML4. Do not forget 'caption' (also in 3.2).
    [color=blue]
    > display: table-column;[/color]

    Advanced stuff like 'display' or 'position' has always been problematic
    with generated context. File bug-reports, if you are sure you made no
    mistake in your test-case.

    Comment

    • Christoph Päper

      #3
      Re: ::before/after on Elements Styled with display: table-*

      Christoph Päper:[color=blue]
      > Lachlan Hunt:[color=green]
      >> table>:not(col) :not(colgroup): first-child::before {
      >> display: table-column;[/color]
      >
      > File bug-reports, if you are sure you made no mistake in your test-case.[/color]

      I suppose not everyone here is reading www-style, too. Those of you
      should know that it in fact should *not* work, because '::before' is not
      actually put before the box, but before all of its child boxes. (How
      could I forget that?) I'm too lazy to look up whether ':first-child'
      should apply to it then.

      Comment

      • Pawel Knapik

        #4
        Re: ::before/after on Elements Styled with display: table-*


        "Christoph Päper" wrote[color=blue]
        > Christoph Päper:[color=green]
        > > Lachlan Hunt:[color=darkred]
        > >> table>:not(col) :not(colgroup): first-child::before {
        > >> display: table-column;[/color]
        > >
        > > File bug-reports, if you are sure you made no mistake in your test-case.[/color]
        >
        > I suppose not everyone here is reading www-style, too. Those of you
        > should know that it in fact should *not* work, because '::before' is not
        > actually put before the box, but before all of its child boxes. (How
        > could I forget that?) I'm too lazy to look up whether ':first-child'
        > should apply to it then.[/color]

        W3C CSS spec:

        User agents must ignore the following properties with :before and :after
        pseudo-elements: 'position', 'float', list properties, and table properties.

        The :before and :after pseudo-elements elements allow values of the
        'display' property as follows:
        - If the subject of the selector is a block-level element, allowed values
        are 'none', 'inline', 'block', and 'marker'. If the value of the 'display'
        has any other value, the pseudo-element will behave as if the value were
        'block'.
        - If the subject of the selector is an inline-level element, allowed values
        are 'none' and 'inline'. If the value of the 'display' has any other value,
        the pseudo-element will behave as if the value were 'inline'.


        Comment

        • Christoph Päper

          #5
          Re: ::before/after on Elements Styled with display: table-*

          Pawel Knapik:[color=blue]
          > W3C CSS spec:[/color]

          CSS 2.0 that is. CSS 2.1 relaxes many of the requirements regarding
          generated content. CSS 2.0 already said:

          | Note. Other values may be permitted in future levels of CSS.

          <http://www.w3.org/TR/CSS2/generate.html#b efore-after-content>
          <http://www.w3.org/TR/CSS21/generate.html#b efore-after-content>

          (Yes, CSS 2.1 is back to WD status for at least another week.)

          Comment

          Working...