Forums

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

Home Forums CSS Styling php .date function with css

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #181590
    Dejan
    Participant

    Hi,

    i have this line of code for blog:

    echo ‘

    Posted on ‘.date(‘d M Y’, strtotime($row[‘postDate’])).’

    ‘;

    How can i edit date in css. I have found the tutorial for css date icon, but i can’t figure it out where to use span class in this echo post. To have icon with d M Y?

    Thanks for answers.

    #181597
    Paulie_D
    Member

    CSS styles HTML

    What HTML does your PHP function output?

    #181607
    Dejan
    Participant

    echo ' Posted on '.date('d M Y', strtotime($row['postDate'])).'

    ‘;this is the code,
    i want to make icon out of date like link to icon.

    HTML output is Posted on 31 august 2014

    #181620
    Paulie_D
    Member

    echo ' Posted on '.date('d M Y', strtotime($row['postDate'])).'

    I’m guessing just outputs a date…it’s not outputting HTML elements.

    Into what HTML element is the output placed?

    #181621
    Dejan
    Participant

    oh i see, the paragraphs where missing in the question.

    echo '<p>Posted on '.date('d M Y', strtotime($row['postDate'])).'</p>';

    its like that, so it is in paragraphs.

    #181637
    Paulie_D
    Member

    So it outputs a <p>Posted on 31 august 2014</p>?

    Not much you can do with that if you are trying to turn it into a ‘calendar like’ icon.

    At the very least it should be broken up into separate parts like…

    
    <p class="post-date">
    <span class="post-date-head">Posted on</span>
    <span class="post-date-day">31</span>
    <span class="post-date-month">August</span>
    <span class="post-date-year">2014</span>
    </p>
    

    That way we have separate elements that can be styled individually.

    Get your PHP to spit that out…and you have a shot.

    #181684
    Dejan
    Participant

    Thanks i think i did it. Now i just need to style it with CSS.

    echo '<span class="post-date-day">'.date('d', strtotime($row['postDate'])). '</span>';
                                echo '<span class="post-date-month">'.date('M', strtotime($row['postDate'])). '</span>';
                                echo '<span class="post-date-year">'.date('Y', strtotime($row['postDate'])). '</span>';
    #181703
    Paulie_D
    Member

    So now you have the elements in place…you can see what you can do.

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