Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS Based on Today’s day or Week

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #45413
    JorgeRivero
    Member

    Hi everyone,

    I have a page with a list of records “dynamic content” what i want to know if is possible to change the css style for the newest on the list, but just for today or for the week, but tomorrow or next week those records will get back to the original css style automatically, and how I can achieve that.

    If someone can give me a clue I’ll really appreciate
    Thanks in advanced.

    #138176
    chrisburton
    Participant

    `:first-of-type` or `:first-child`

    `:first-child` has better browser support for IE.

    #138228
    JorgeRivero
    Member

    Thank you chrisburton,

    :first-child will do the work for the last added, but what if I add 15 new records on the list today, I want all 15 to be different color til tomorrow.

    Thanks again.

    #138230
    Paulie_D
    Member

    Then you’ll need javascript

    #138238
    CrocoDillon
    Participant

    JS will only work if you can somehow detect the date the records are added (must be outputted in the html, or in JS). Alternatively, you can use back-end languages like PHP to add a class to those new records.

    #138324
    Blackhawkso
    Member

    I agree with @CrocoDillon PHP is the best way to go about it.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘CSS’ is closed to new topics and replies.