• Hey ya,
    Thanks for the explaination of the ins tag. I would like to have anything I write inside an ins tag always be prefaced with “Inserted time –” without always having to type that. Is there a CSS hack that will let you define the ins tag to always display this preface text? (Once can do this in Microsoft Excel with a “special number format”, so that the number 1 would appear as “1 ringy-dingy” for example.)

Viewing 10 replies - 1 through 10 (of 10 total)
  • You could make a Quicktag do that ?
    http://www.mfr.f2s.com/quicktags/

    But there is already a quicktag for ins 🙂
    He want’s the ins tag’s contents styled and displayed, which I don’t think is easy. I mean the tag’s contents are not displayed, right?

    Thread Starter strunk

    (@strunk)

    Yeah, I would guess that maybe this is something to be done with PHP rather than with CSS, since CSS is supposed to be presentation, seperated from content. But while I know some CSS, I know no PHP.

    You know, I have no idea ….. I might play with that later then.

    Thread Starter strunk

    (@strunk)

    OK, it looks like it can maybe be done with the :before pseudo-element:
    http://www.webmasterworld.com/forum83/3891.htm
    THat would be pretty cool. I don’t know if there’d be a way to insert a variable corresponding to the date, but it looks like I could at least insert “Update–” or something like that.
    Here’s a ref from the W3C:
    http://www.w3.org/TR/REC-CSS2/selector.html#before-and-after

    Yes, it can be done in css, but almost no browsers support it (the content property, with before and after psuedo selectors – css3 I do believe).
    So.. php is your way to go. I simple filter installed into WP would work.

    using :before and :after and content: will do the trick. No IE though. Only Moz/Opera I believe. Oh… and it’s CSS2, just that the IE team felt that it was not prudent to include many CSS2 functionalities.

    Actually, the latest IE7 hack adds partial support for :before/:after/:content in IE. Apparently it’s still a bit shaky, though.

    Thread Starter strunk

    (@strunk)

    OK, so you can insert a variable into the :before pseudo-element, as long as it’s a variable that is specified inside the HTML tag you are styling with :before.
    Here’s my CSS:
    ins:before {
    content: attr(datetime);
    }

    And here’s my output:

    2004-7-25T13:29:52-4:00 Now with bonus Velvet Underground reference!

    If I’m reading the W3C spec right, I can have either a variable (one variable) or text, but not both. Also, I wonder why the ins tag is returning last month instead of this month? Anyway, that’s pretty neat.
    Here’s the W3C ref:
    http://www.w3.org/TR/REC-CSS2/generate.html#content

    Here’s the IE7 hack referred to above.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Can I insert text with CSS?’ is closed to new replies.